← Back to blog
bpdubuntu

Adding Centralized Logging with Loki and Promtail to Your Container Stack

12 December 2025bpd · ubuntu

Complete Your Observability Stack with Logs

Metrics tell you what’s happening, but logs tell you why. To complete the monitoring solution, the ‘Ubuntu System Administration Guide’ explains how to add log aggregation to your containerized stack using Grafana Loki and Promtail.

The Loki and Promtail Duo

  • Loki: Developed by Grafana Labs, Loki is a log aggregation system designed to be highly efficient and cost-effective. It stores and indexes logs, making them searchable.
  • Promtail: This is the agent that collects logs. You run Promtail in a container, and it discovers and ‘tails’ log files on your server, sending them to the central Loki instance.

By adding Loki and Promtail services to your `docker-compose.yaml` file, you can then add Loki as a data source in Grafana. This allows you to explore your logs and correlate them with your metrics, all within the same Grafana dashboard.


This post is based from content of the book Ubuntu System adminstration guide. And the book can be found here https://www.amazon.com/stores/Mattias-Hemmingsson/author/B0FF5CQX13