Prometheus-style log aggregation that indexes labels, not full text - cheap and Grafana-native. This walkthrough covers the mental model and the configuration you will actually touch.
Loki is a horizontally scalable log system that indexes only labels (not the full log line), making it far cheaper than traditional log stores and a natural fit next to Prometheus and Grafana.
The configuration that matters
Promtail scraping local logs and shipping to Loki.
server: { http_listen_port: 9080 }
clients: [{ url: http://loki:3100/loki/api/v1/push }]
scrape_configs:
- job_name: system
static_configs:
- targets: [localhost]
labels: { job: varlogs, __path__: /var/log/*log }Principles to hold onto
- Keep labels low-cardinality; filter within the stream using LogQL
- Set per-tenant retention and ingestion limits
- Structure logs (logfmt/JSON) so LogQL parsers work well
Everyday commands
LogQL queries for filtering and metrics from logs.
{job="varlogs"} |= "error" | logfmt | status >= 500
# turn logs into a rate metric
sum(rate({app="web"} |= "panic" [5m]))Want senior help putting Grafana Loki to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.