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

Promtail with Docker+Journal #797

Closed
tfchan0 opened this issue Jul 25, 2019 · 3 comments
Closed

Promtail with Docker+Journal #797

tfchan0 opened this issue Jul 25, 2019 · 3 comments
Assignees

Comments

@tfchan0
Copy link

tfchan0 commented Jul 25, 2019

Hi, I'm new to Loki and trying out the Promtail with JournalD support. Currently we are using journal driver for Docker. With Promtail recent commit #730 I'm able to retrieve journal entry into Loki.

However, wonder if there's a way to enrich the log with Kubernetes labels (namespace, pod name, etc)?

Thanks!

@tfchan0 tfchan0 changed the title Promtail with JournalD Promtail with Docker+Journal Jul 25, 2019
@rfratto
Copy link
Member

rfratto commented Jul 25, 2019

Hi! Unfortunately, I'm not sure this is possible using just the journal support: when reading logs from the journal, promtail isn't aware of any extra metadata about the environment that's not already placed in the labels of each journal entry; so while the journal docker driver adds fields like CONTAINER_ID and you could pull that out, it doesn't seem to me that you can add Kubernetes-specific metadata in there. (But I could be wrong! I tried searching out for you but wasn't able to find anything.)

If you're trying to read logs from Kubernetes containers along with all the metadata, what's worked in production for us is deploying Promtail as a DaemonSet, bind mounting the host's log directory, and configuring promtail to discover and read from those files directly rather than through something like the systemd journal:

@tfchan0
Copy link
Author

tfchan0 commented Jul 25, 2019

Thanks @rfratto for the response. For the model of having Promtail to parse logs from /var/log (generated by Docker driver), does Promtail glean the Kubernetes info/label from the log's medadata? Or does it query kube-api for k8s information? Thanks!

@rfratto
Copy link
Member

rfratto commented Jul 25, 2019

Promtail gets the metadata from the Kubernetes REST API. Internally it's using Prometheus' discovery code for doing that, reference on configuration and more details here: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config

@tfchan0 tfchan0 closed this as completed Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants