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

Add docker image name:revision attribute to journald logging driver events #21497

Closed
CpuID opened this issue Mar 25, 2016 · 7 comments
Closed
Labels
area/logging kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Comments

@CpuID
Copy link

CpuID commented Mar 25, 2016

Currently there is the ability to expose env and labels log-opt values for the journald log driver, to add selected environment variables and labels attached to a container to each log event.

It would be nice to have the Docker image name and revision also, either by default or as a log-opt.

I suspect this will relate to gelf/fluentd similarly as per #16961

This would give the journald log driver (when combined with journalbeat) feature parity to using docker-logstash-forwarder

@thaJeztah
Copy link
Member

Have you tried --log-opt tag=.....? https://docs.docker.com/engine/admin/logging/log_tags/

@CpuID
Copy link
Author

CpuID commented Mar 26, 2016

Not a bad option @thaJeztah - I guess that would make the Container ID and the Image ID into a single attribute (eg. --log-opt tag="{{.ImageName}}---{{.ID}}"), but I could easily do that with a sane delimiter and parse it out on the Logstash side.

@CpuID
Copy link
Author

CpuID commented Mar 26, 2016

Feel free to close if there is no interest in doing this as a first class log event attribute :)

@thaJeztah thaJeztah added area/logging kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. labels Mar 26, 2016
@thaJeztah
Copy link
Member

I'm not entirely against adding them as separate properties (given that that information is already there in the context); depends a bit on how likely it is that people use this. Also when making changes to logging, performance is always important, so adding these attributes shouldn't affect performance.

I'll leave it open for now, so see if there's more interest in this.

@CpuID
Copy link
Author

CpuID commented Mar 28, 2016

No problem, thanks :)

@thaJeztah
Copy link
Member

There's some work being done for other logging drivers, e.g. #25633, so possibly we can reuse once it's there

@RohitK89
Copy link

👋 I opened the PR above to add this functionality.

My company is using fluent with native docker to grab logs from containers. We have docker log to journald and then use fluentbit to forward to splunk, and using a tag as the placeholder for image names seems less than ideal. Engineers requested being able to search for log messages using a proper key for the image name, so I thought I'd help make that happen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logging kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Projects
None yet
Development

No branches or pull requests

3 participants