This repo contains the source code for my article Better docker logs with Loki, which demonstrates how to use Grafana Loki for better Docker Logs during development.
git clone https://github.com/brpaz/logs-with-loki
cd logs-with-loki
docker-compose up -d
This will start Grafana, Loki, Promtail and a Sample demo app using ealen/echo-server.
You can access your Grafana Dashboard, by going to localhost:3000
and login with admin/testloki
.
The Loki datasource should already configured: (you can check it by navigating to: http://localhost:3000/datasources).
If you click on Loki datasource, and go down, press the "Test" button to ensure that Grafana can communicate with Loki.
Then open "Explore" tab on the left, and you will see Loki interface.
If you click "Log labels", you should see some labels already populated from the Docker images.
The most useful one is the "container_name". Select one of the containers like logs-with-loki_grafana_1
and you should see the respective logs appear.