logging: Add container labels to log entries on journald#562
Merged
rhatdan merged 1 commit intocontainers:mainfrom Jun 1, 2025
Merged
logging: Add container labels to log entries on journald#562rhatdan merged 1 commit intocontainers:mainfrom
rhatdan merged 1 commit intocontainers:mainfrom
Conversation
Contributor
Author
|
Podman PR: containers/podman#26203 |
fc7c6a6 to
10a3e75
Compare
Contributor
Author
|
I think this PR fixes #336 after all. |
Contributor
Author
|
Ephemeral COPR build failed. @containers/packit-build please check. |
At present it's not possible to ship properly labeled logs when using podman and tools like podman-compose. Container labels are lost which makes it much harder to understand where a particular log line originated from. Log processing and analysis is significantly more inconvenient as well, because it's hard to group related logs, e.g. coming from the same compose project. This commit implements the parts necessary to annotate log messages with container labels. Each label and value pair is specified via --log-label LABEL=VALUE arguments. Co-authored-by: OZoneGuy <oalkersh@protonmail.com> Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
Member
|
LGTM |
Contributor
Author
|
@haircommander Would it be possible to release new version of conmon with this PR? I think containers/podman#26203 depends on new version of conmon. If new release is too early, I'm sorry for the noise and will wait for whenever a release will be made. |
bitoku
reviewed
Jun 4, 2025
Comment on lines
+161
to
+168
| if (!use_journald_logging) { | ||
| if (!tag) { | ||
| nexit("k8s-file doesn't support --log-tag"); | ||
| } | ||
| if (!log_labels) { | ||
| nexit("k8s-file doesn't support --log-label"); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
It looks wrong to me...
It should be if (tag) { maybe?
Member
There was a problem hiding this comment.
yes that seems wrong, could you please open a PR so we can get it merged quickly?
Contributor
|
cri-o is facing CI failure and seeing conmon failure. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
At present it's not possible to ship properly labeled logs when using podman and tools like podman-compose. Container labels are lost which makes it much harder to understand where a particular log line originated from. Log processing and analysis is significantly more inconvenient as well, because it's hard to group related logs, e.g. coming from the same compose project.
This commit implements the parts necessary to annotate log messages with container labels. Each label and value pair is specified via --log-label LABEL=VALUE arguments.
This PR was initially based on #553 and ultimately was reworked enough that there's little semblance to the original PR anymore. Attribution is still preserved in commit message. The following is the changes from the 553 PR:
--log-labelbeing used with k8s-filepodmanand currently runs in production. Podman PR: libpod: Implement --log-opt label=LABEL=Value podman#26203.Fixes #336.