Repository navigation
fix(api): respect service_name query param in application logs endpoint - #12066
Merged
Merged
Conversation
GET /applications/{uuid}/logs ignored service_name and always returned
logs from the first container, so 'coolify app logs --service' could show
logs from the wrong Compose service. When service_name is present, select
the container whose labels contain the matching
com.docker.compose.service entry and 404 when nothing matches.
Contributor
Author
|
Friendly maintainer review request: this contribution has been updated with the latest fixes and checks. Please review when convenient. Thank you. |
yannisgu
added a commit
to yannisgu/coolify
that referenced
this pull request
Oct 21, 2026
GET /applications/{uuid}/logs already accepts service_name (a key under
`services:`) to pick the container of a Docker Compose service, and the
preview logs endpoint documents it too. But preview containers carry the
Compose service name with a -pr-<id> suffix, so
/previews/{pull_request_id}/logs?service_name=worker always returned 404.
coolify-cli sends the plain service name for its --service flag.
Match the plain name and the suffixed preview name. Without service_name
the first container is still returned; a service without a running
container still returns 404.
Ported from github.com/yannisgu/coolify fix/api-logs-service-name
(coollabsio#11919); the non-preview part is already upstream
(coollabsio#12066, 8bbab72).
yannisgu
added a commit
to yannisgu/coolify
that referenced
this pull request
Oct 21, 2026
GET /applications/{uuid}/logs already accepts service_name (a key under
`services:`) to pick the container of a Docker Compose service, and the
preview logs endpoint documents it too. But preview containers carry the
Compose service name with a -pr-<id> suffix, so
/previews/{pull_request_id}/logs?service_name=worker always returned 404.
coolify-cli sends the plain service name for its --service flag.
Match the plain name and the suffixed preview name. Without service_name
the first container is still returned; a service without a running
container still returns 404.
Ported from github.com/yannisgu/coolify fix/api-logs-service-name
(coollabsio#11919); the non-preview part is already upstream
(coollabsio#12066, 8bbab72).
yannisgu
added a commit
to yannisgu/coolify
that referenced
this pull request
Oct 21, 2026
GET /applications/{uuid}/logs already accepts service_name (a key under
`services:`) to pick the container of a Docker Compose service, and the
preview logs endpoint documents it too. But preview containers carry the
Compose service name with a -pr-<id> suffix, so
/previews/{pull_request_id}/logs?service_name=worker always returned 404.
coolify-cli sends the plain service name for its --service flag.
Match the plain name and the suffixed preview name. Without service_name
the first container is still returned; a service without a running
container still returns 404.
Ported from github.com/yannisgu/coolify fix/api-logs-service-name
(coollabsio#11919); the non-preview part is already upstream
(coollabsio#12066, 8bbab72).
yannisgu
added a commit
to yannisgu/coolify
that referenced
this pull request
Oct 25, 2026
GET /applications/{uuid}/logs already accepts service_name (a key under
`services:`) to pick the container of a Docker Compose service, and the
preview logs endpoint documents it too. But preview containers carry the
Compose service name with a -pr-<id> suffix, so
/previews/{pull_request_id}/logs?service_name=worker always returned 404.
coolify-cli sends the plain service name for its --service flag.
Match the plain name and the suffixed preview name. Without service_name
the first container is still returned; a service without a running
container still returns 404.
Ported from github.com/yannisgu/coolify fix/api-logs-service-name
(coollabsio#11919); the non-preview part is already upstream
(coollabsio#12066, 8bbab72).
yannisgu
added a commit
to yannisgu/coolify
that referenced
this pull request
Oct 26, 2026
GET /applications/{uuid}/logs already accepts service_name (a key under
`services:`) to pick the container of a Docker Compose service, and the
preview logs endpoint documents it too. But preview containers carry the
Compose service name with a -pr-<id> suffix, so
/previews/{pull_request_id}/logs?service_name=worker always returned 404.
coolify-cli sends the plain service name for its --service flag.
Match the plain name and the suffixed preview name. Without service_name
the first container is still returned; a service without a running
container still returns 404.
Ported from github.com/yannisgu/coolify fix/api-logs-service-name
(coollabsio#11919); the non-preview part is already upstream
(coollabsio#12066, 8bbab72).
yannisgu
added a commit
to yannisgu/coolify
that referenced
this pull request
Oct 26, 2026
GET /applications/{uuid}/logs already accepts service_name (a key under
`services:`) to pick the container of a Docker Compose service, and the
preview logs endpoint documents it too. But preview containers carry the
Compose service name with a -pr-<id> suffix, so
/previews/{pull_request_id}/logs?service_name=worker always returned 404.
coolify-cli sends the plain service name for its --service flag.
Match the plain name and the suffixed preview name. Without service_name
the first container is still returned; a service without a running
container still returns 404.
Ported from github.com/yannisgu/coolify fix/api-logs-service-name
(coollabsio#11919); the non-preview part is already upstream
(coollabsio#12066, 8bbab72).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12055.
Problem
GET /api/v1/applications/{uuid}/logsignoredservice_nameand always returned logs from the first container ($containers->first()), socoolify app logs --service <name>could show logs from the wrong Compose service.Fix
When
service_nameis present, select the container whoseLabelscontain the matchingcom.docker.compose.service=<name>entry (exact, comma-delimited match via regex sowebcan't matchweb2) and return 404 when no running container matches. Without the parameter, behavior is unchanged. The OpenAPI docblock now documents the parameter.Testing
php -lclean. Repro per #12055: compose app withweb+worker—?service_name=workernow returns worker logs; an unknown name returnsNo running container found for service_name 'x'.