Grafana Loki | Grafana Loki documentation
Grafana Loki
Grafana Loki is a set of open source components that can be composed into a fully featured logging stack. A small index and highly compressed chunks simplifies the operation and significantly lowers the cost of Loki.
Overview
Unlike other logging systems, Loki is built around the idea of only indexing metadata about your logs’ labels (just like Prometheus labels). Log data itself is then compressed and stored in chunks in object stores such as Amazon Simple Storage Service (S3) or Google Cloud Storage (GCS), or even locally on the filesystem.
Give it a try using Grafana Play
With Grafana Play, you can explore and see how it works, learning from practical examples to accelerate your development. This feature can be seen on Logs Drilldown.
Explore
Grafana Loki, frequently asked questions
Where should I start if I’m new to Loki?
Start with the Loki Tutorial, which walks you through what Loki is, how it works, and how the components fit together.
- Try it locally. The fastest way to experiment is to run Loki in monolithic (single-binary) mode with a local filesystem backend and send logs to it with Grafana Alloy.
- Understand labels. Loki’s indexing model is label-based. Read Labels and the label best practices early.
- Learn LogQL. LogQL is Loki’s query language.
- Explore with Grafana. Connect Loki as a data source in Grafana and use Explore to run ad-hoc queries against your logs.
The Grafana Labs Learning Hub offers self-paced, hands-on courses relevant to Loki:
- Send logs to Grafana Cloud using Alloy
- Send data from external collectors
- Explore your infrastructure data with Grafana Drilldown apps
- Optimize Adaptive Logs
Should I self-host or use Grafana Cloud for logs?
The right answer depends on your team’s capacity and priorities. Choose Grafana Cloud if you want to get up and running quickly, prefer not to manage infrastructure, or are a small team without dedicated operations resources.
Choose self-hosted OSS or Enterprise if you have strict data residency or compliance requirements.
What are the best practices for Loki labels vs. structured metadata?
- Labels define a log stream.
- ✅ Use labels for low-cardinality dimensions you will always filter on:
env,cluster,namespace,app,job. - ❌ Do not use labels for high-cardinality values.
Why does service_name show as unknown_service in Explore Logs?
Common causes include missing metadata from the log shipper or misconfiguration in Loki's settings.
How do I fix “ingestion rate limit exceeded” (HTTP 429) errors?
A 429 error from Loki means an ingestion rate limit has been hit. Check your log shipper settings for identifying the streams responsible.
Why can’t Grafana connect to Loki when both are running in Docker?
Use the correct datasource URL in Docker Compose to ensure connectivity.
YAML
services:
loki:
image: grafana/loki:latest
ports:
- "3100:3100"
grafana:
image: grafana/grafana:latest
environment:
- GF_DATASOURCES_DEFAULT_URL=http://loki:3100
What causes “Too many outstanding requests” errors on my dashboard?
This error occurs when the number of concurrent queries to Loki exceeds the configured limit for a tenant.
How do I make a LogQL query return zero instead of “no data”?
Workaround using or on() vector(0) to ensure queries return zero instead of no data.
Why isn’t my log retention policy deleting old data?
Retention in Loki is handled by the Compactor. Configure it correctly to ensure retention is active.