Is there a basic docker-compose.yml that sets up loki, promtail and grafana ?
I just need two simple things:
There is a container that log “hello world” every minute.
I’m able to see the “hello world” log text in grafana.
I have spent a full day trying to get this working on my mac that is used for development and staging. I gave up as I think that the path to docker log files when running on mac is not the same as on linux. I also tried to get this working on ubuntu production server. Here I get “Data source connected, but no labels were received. Verify that Loki and Promtail are correctly configured.” when adding loki to grafana.
I do not understand why this is so complex. I just want to do:
docker compose up -d
And then see the logs in grafana.
I do not want to use the loki-docker-driver as then it is not possible to read the logs in portainer or docker-desktop ?
I would recommend to start with Linux, instead of trying both platforms the same time. Linux has host network mode, which is a easy to configure between containers.
I don’t have a hello world example, but our article is straightforward solution to configure Loki, Promtail, Grafana for NGINX + YouTube tutorial for dashboard configuration.
Thanks to you I got the same config working on my Mac and the Ubuntu docker hosts.
The key that unlocked the problem was in promtail volumes definition
/var/run/docker.sock:/var/run/docker.sock
And how scrape_configs was set up in promtail config file.
I also managed to get loki to log to a docker volume instead of the host disk / inside the loki container.
now I can do docker compose up - and it just works
Is anyone need it - here is my two files
docker-compose.yml :