Add journald tag as SYSLOG_IDENTIFIER#35570
Conversation
Signed-off-by: Vlastimil Zeman <vlastimil.zeman@diffblue.com>
|
Thanks for contributing! While this seems like a good addition, I'd like to discuss this a bit more before we go ahead, and get input from more people. Changing the format could be a breaking change for people that consume the logs, so we should be careful to enable this by default. An alternative could be to have a separate option to set the identifier (e.g. Open to input/suggestions on this 👍 |
|
@thaJeztah Thanks for quick response!
PS I am not against |
|
Discussing in the maintainers meeting, and generally, we think it's ok to make this change, but I'm checking with some other people to be sure about the change in output format 👍 |
|
One issue is being raised that the identifier in journald was added for compatibility with syslog, which takes a specific format, in which case it would contain |
|
@thaJeztah Thanks for carrying this forward! |
|
Yes, wondering if that should be the correct use, but perhaps we're over-thinking it 😅 |
|
@thaJeztah I would be glad for getting this basic version in and maybe add syslogy version if somebody complains. |
|
I have not hear objections since last time, so moving to code review |
|
@cpuguy83 wants to double-check, and give this another look |
|
This is really strange... it seems like there's a regression here because I'm pretty sure it used to log deatils about the container and have them viewable in journalctl. |
|
From the journald docs:
So I guess this is good. |
|
@cpuguy83 I think it was always like this, but see #20443 (comment) |
|
Yeah, I could be thinking about syslog... |


- What I did
This PR fixes #30023 (not showing journald tag in basic
journalctloutput).See example below.
Run container with logging driver
journaldwith optiontag:docker run --log-driver=journald --log-opt tag="{{.ImageName}}/{{.Name}}/{{.ID}}" --rm alpine ping -c 1 8.8.8.8Currently, logs are sent to
journaldwithout setting tag toSYSLOG_IDENTIFIERwhich causing that user inspecting logs from cli usingjournalctlis not able to assign log record to container/tag. All logs are shown asdockerdmessages.Adding tag also to
SYSLOG_IDENTIFIERenable a user to see it injournalctland use--identifierwith pattern matching. Useful if tag contains swarm stack name, service name, task, etc. It will also do not confuse a user which reads documentation about tags.- How I did it
Added logging driver option
tagnot only asCONTAINER_TAG(visible only in extended view, which is not usable for practical troubleshooting) but also asSYSLOG_IDENTIFIERwhich support pattern matching.- How to verify it
See what I did
- Description for the changelog
Add journald tag as SYSLOG_IDENTIFIER
- A picture of a cute animal (not mandatory but encouraged)
