Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include name and tag of a container into journald message for syslog [WIP] #273

Closed
wants to merge 1 commit into from

Conversation

tobwen
Copy link

@tobwen tobwen commented Jun 7, 2021

summary

When writing logs from conmon into journald and post-process the journal with rsyslog or others, there's no way to filter logs from plain syslog messages. This PR prefixes the container's name and its tags (if set) to each message. See: #271

syntax

container-name[container-tag]

examples

container-name has been set, container-tag has been set

Jun 7 00:00:00 debian conmon[666]: podman-nginx[test-buid-20210706] message

only container-name has been set

Jun 7 00:00:00 debian conmon[667]: podman-nginx It works.

only container-tag has been set

Jun 7 00:00:00 debian conmon[668]: [test-buid-20210706] It works.

neither ... nor ... has been set

Jun 7 00:00:00 debian conmon[669]: It works.

# summary
When writing logs from _conmon_ into _journald_ and post-process the journal with _rsyslog_ or others, there's no way to filter logs from plain _syslog_ messages. This PR prefixes the container's name and its tags (if set) to each message.

# syntax
`container-name[container-tag]`

# examples
## container-name has been set, container-tag has been set
`Jun  7 00:00:00 debian conmon[666]: podman-nginx[test-buid-20210706] message`

## only container-name has been set
`Jun  7 00:00:00 debian conmon[667]: podman-nginx It works.`

## only container-tag has been set
`Jun  7 00:00:00 debian conmon[668]: [test-buid-20210706] It works.`

## neither ... nor ... has been set
`Jun  7 00:00:00 debian conmon[669]: It works.`
@haircommander
Copy link
Collaborator

thanks for the PR @tobwen LGTM

@haircommander
Copy link
Collaborator

one thing of note: I wonder if this break compatibilty with the docker journald log driver (on which this behavior was based)

@tobwen
Copy link
Author

tobwen commented Jun 7, 2021

one thing of note: I wonder if this break compatibilty with the docker journald log driver (on which this behavior was based)

True. I can try to add a switch. But I'd also need to make changes to podman then (--log-opt).

@haircommander
Copy link
Collaborator

one thing of note: I wonder if this break compatibilty with the docker journald log driver (on which this behavior was based)

True. I can try to add a switch. But I'd also need to make changes to podman then (--log-opt).

yeah I think that'd be best

@tobwen tobwen changed the title include name and tag of a container into journald message for syslog include name and tag of a container into journald message for syslog [WIP] Jun 7, 2021
@tobwen
Copy link
Author

tobwen commented Jun 18, 2021

Implementation is too complicated and the audience is too little. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants