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
+168
View File
@@ -2675,6 +2675,16 @@
"format": "int32",
"default": 100
}
},
{
"name": "show_timestamps",
"in": "query",
"description": "Show timestamps in the logs.",
"required": false,
"schema": {
"type": "boolean",
"default": false
}
}
],
"responses": {
@@ -5952,6 +5962,80 @@
]
}
},
"\/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": [
@@ -11293,6 +11377,90 @@
]
}
},
"\/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": [