How to use Promtail to scrape Docker container stdout?

I want to deploy a Grafana Loki + Promtail in a Docker stack and scrape the standard output from all containers running. What do I have to set up and configure? Can you point me to the correct resources?

In the docs on Github I can only find an example docker-compose that starts Promtail as a service with the following config: https://github.com/grafana/loki/blob/master/cmd/promtail/promtail-docker-config.yaml

Is this already enough for Promtail to discover and scrape all containers or am I missing something?

Thanks in advance

1 Like

Would be also interested in this. Anybody has any specific steps how to implement this ?

1 Like

Use file under /var/lib/docker/containers/{CONTAIENRID}/{CONTAINERID}-json.log

I would also like to do this, using the /var/lib/docker/ volume mounting solution can’t work for me as I don’t have permissions to mount hostPath volumes.

The kubernetes api has a way to search for pods and tail logs, I’m not sure why its not just using that api.