fix(api): normalize log endpoint query handling

Clamp log line counts, parse timestamp flags consistently, and filter
service subcontainers by Coolify labels. Document log endpoint timestamp
parameters and database/service log routes in OpenAPI.
This commit is contained in:
Andras Bacsai
2026-07-06 23:58:12 +02:00
parent adc4b3091f
commit ff5cfd4253
7 changed files with 417 additions and 19 deletions
+118
View File
@@ -1716,6 +1716,14 @@ paths:
type: integer
format: int32
default: 100
-
name: show_timestamps
in: query
description: 'Show timestamps in the logs.'
required: false
schema:
type: boolean
default: false
responses:
'200':
description: 'Get application logs by UUID.'
@@ -3908,6 +3916,57 @@ paths:
security:
-
bearerAuth: []
'/databases/{uuid}/logs':
get:
tags:
- Databases
summary: 'Get database logs.'
description: 'Get database logs by UUID.'
operationId: get-database-logs-by-uuid
parameters:
-
name: uuid
in: path
description: 'UUID of the database.'
required: true
schema:
type: string
format: uuid
-
name: lines
in: query
description: 'Number of lines to show from the end of the logs.'
required: false
schema:
type: integer
format: int32
default: 100
-
name: show_timestamps
in: query
description: 'Show timestamps in the logs.'
required: false
schema:
type: boolean
default: false
responses:
'200':
description: 'Get database logs by UUID.'
content:
application/json:
schema:
properties:
logs: { type: string }
type: object
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'404':
$ref: '#/components/responses/404'
security:
-
bearerAuth: []
'/databases/{uuid}/backups/{scheduled_backup_uuid}/executions/{execution_uuid}':
delete:
tags:
@@ -7150,6 +7209,65 @@ paths:
security:
-
bearerAuth: []
'/services/{uuid}/logs':
get:
tags:
- Services
summary: 'Get service logs.'
description: 'Get logs for a specific service sub-resource by service UUID. The `sub_service_name` query parameter must match the `name` field of one of the service applications or databases returned by `GET /services/{uuid}`.'
operationId: get-service-logs-by-uuid
parameters:
-
name: uuid
in: path
description: 'UUID of the service.'
required: true
schema:
type: string
format: uuid
-
name: sub_service_name
in: query
description: 'Sub-service name from `GET /services/{uuid}` under `applications[].name` or `databases[].name`. Do not use `human_name` or the Docker container name with the service UUID suffix.'
required: true
schema:
type: string
example: appwrite-console
-
name: lines
in: query
description: 'Number of lines to show from the end of the logs.'
required: false
schema:
type: integer
format: int32
default: 100
-
name: show_timestamps
in: query
description: 'Show timestamps in the logs.'
required: false
schema:
type: boolean
default: false
responses:
'200':
description: 'Get service logs by UUID.'
content:
application/json:
schema:
properties:
logs: { type: string }
type: object
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'404':
$ref: '#/components/responses/404'
security:
-
bearerAuth: []
'/services/{uuid}/envs':
get:
tags: