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

Allow For Container Name To Be Shown In Journald #293

Closed
p0da opened this issue Aug 19, 2021 · 7 comments
Closed

Allow For Container Name To Be Shown In Journald #293

p0da opened this issue Aug 19, 2021 · 7 comments

Comments

@p0da
Copy link

p0da commented Aug 19, 2021

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

Would it be possible to add a feature that prefixes journald log messages with the relevant container/tag information? It looks like this exact feature was started in: #273 but never got finished. Thanks.

@haircommander
Copy link
Collaborator

what version of conmon/podman? this should be working

@p0da
Copy link
Author

p0da commented Aug 22, 2021

I'm on arch so everything should be up to date:

$ podman --version
podman version 3.3.0
$ conmon --version
conmon version 2.0.29
commit: 7e6de6678f6ed8a18661e1d5721b81ccee293b9b

To elaborate a bit:

$ podman run --log-driver journald --name TEST busybox echo "test message"

ideally would include the name somewhere in the corresponding journald message but currently it is just:

conmon[52655]: test message

@nebulon42
Copy link

nebulon42 commented Aug 23, 2021

I'm also seeing this on Ubuntu 20.04 with podman 3.2.3 (updated yesterday but didn't yet receive 3.3.0). The messages have the conmon unit and it is not possible to discern from which container they were originating.

I have two more questions to journald logging, hopefully fitting here, otherwise tell me where else to put them:

  • Since you want to make journald logging the default on sytemd machines will then podman logs be non-functional or would it read the logs from the journal? At least now for me podman logs outputs nothing when logging to journald. This is connected to the problem of this ticket because I could use podman logs to see which log line belongs to which container.
  • I have set the log_driver in my containers.conf file but when I don't specify --log-driver at podman play kube the logs still go to the file. Am I missing something or is this a bug?

Probably at least the second question should be a separate issue I guess.

@nebulon42
Copy link

@haircommander could you reproduce the problem?

@nebulon42
Copy link

After shipping the journal via fluent-bit I see the following fields for a rootless container:

  • SYSLOG_IDENTIFIER = conmon
  • CONTAINER_NAME
  • CONTAINER_ID
  • CONTAINER_ID_FULL

So it seems that the basic info is there but I guess the SYSLOG_IDENTIFIER should contain the container name maybe?
(Same info can be derived by specifying e.g. journalctl -o json-pretty ....)

@haircommander haircommander transferred this issue from containers/podman Sep 16, 2021
@haircommander
Copy link
Collaborator

ah I see, I misunderstood the ask. I have opened #294 to fix. can someone test and let me know if it satisfies their use case?

@p0da
Copy link
Author

p0da commented Dec 22, 2021

Just updated, feature is working perfectly on my end. Thank you for pushing this feature through @haircommander. Feel free to close this issue as needed.

@rhatdan rhatdan closed this as completed Dec 22, 2021
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

No branches or pull requests

4 participants