Loki SLIs¶
This page documents Service Level Indicators (SLIs) for monitoring the health of Loki. To set up Service Level Objectives (SLOs), see Set up SLOs with Sloth.
These metrics are recommended as Service Level Indicators for Loki. They cover the write path (log ingestion), read path (query serving), and supporting subsystems.
Log ingestion (write path)¶
The distributor receives log streams from Promtail or other clients, and the ingester persists them to object storage. These metrics measure the health of the write path.
Metric |
Type |
Description |
|---|---|---|
|
Counter |
Total log lines received by the distributor |
|
Counter |
Total bytes received by the distributor |
|
Counter |
Total successful append calls to ingesters |
|
Counter |
Samples discarded by |
|
Counter |
Bytes discarded by |
An availability SLI for the write path is the ratio of successful ingester appends:
sum(rate(loki_distributor_ingester_appends_total[5m]))
A discard rate SLI shows the proportion of data being rejected:
sum by (reason) (rate(loki_discarded_samples_total[5m]))
Ingester¶
The ingester holds recent log streams in memory, builds chunks, and flushes them to the backend store. These metrics capture ingester health and resource pressure.
Metric |
Type |
Description |
|---|---|---|
|
Gauge |
Number of active streams held in ingester memory |
|
Gauge |
Number of chunks in ingester memory |
|
Counter |
Total chunks flushed to backend storage |
|
Counter |
Chunk flush failures; should remain at 0 |
|
Gauge |
Number of chunks queued for flushing; high values indicate backend pressure |
A flush failure SLI:
sum(rate(loki_ingester_chunks_flush_failures_total[5m]))
/
sum(rate(loki_ingester_chunks_flushed_total[5m]))
Write-ahead log (WAL)¶
The WAL provides durability for unflushed data in the ingester.
Metric |
Type |
Description |
|---|---|---|
|
Counter |
Failures due to WAL disk being full |
|
Gauge |
Whether WAL replay is currently active (1) or not (0) |
Query performance (read path)¶
Loki serves log queries through the query frontend, queriers, and query scheduler. These metrics measure read-path health.
Metric |
Type |
Description |
|---|---|---|
|
Histogram |
HTTP/gRPC request latency by route, method, and status code |
|
Gauge |
Number of inflight requests across all routes |
|
Gauge |
Number of queries currently being processed |
|
Histogram |
Number of retries per query |
|
Histogram |
Time queries spend in the scheduler queue before being picked up |
|
Gauge |
Inflight queries per worker |
A latency SLI for the read API (P99):
histogram_quantile(0.99, sum by (le) (
rate(loki_request_duration_seconds_bucket{method="gRPC",route!~".*Pusher.*"}[5m])
))
TSDB index¶
Loki uses TSDB-based index storage. These metrics capture index build and maintenance health.
Metric |
Type |
Description |
|---|---|---|
|
Counter |
TSDB index build attempts by |
|
Gauge |
Timestamp of the last successful index build |
|
Counter |
TSDB head rotation attempts by |
|
Counter |
WAL truncation attempts by |
An index build success SLI:
sum by (component) (rate(loki_tsdb_build_index_attempts_total{status="success"}[5m]))
/
sum by (component) (rate(loki_tsdb_build_index_attempts_total[5m]))
Cache¶
Loki uses caching to accelerate queries and reduce storage load. Cache efficiency directly impacts read-path latency.
Metric |
Type |
Description |
|---|---|---|
|
Counter |
Total cache hits |
|
Counter |
Total cache keys fetched |
|
Counter |
Corrupt chunks detected in cache |
A cache hit ratio SLI:
sum(rate(loki_cache_hits[5m]))
/
sum(rate(loki_cache_fetched_keys[5m]))
Ruler (alerting)¶
Loki’s ruler evaluates recording and alerting rules against LogQL expressions.
Metric |
Type |
Description |
|---|---|---|
|
Gauge |
Whether the last ruler config reload succeeded (1 = success, 0 = failure) |
|
Counter |
Alert notification errors |
|
Counter |
Alert notifications dropped |
Ring / cluster membership¶
Loki uses a distributed hash ring for component discovery and ownership.
Metric |
Type |
Description |
|---|---|---|
|
Gauge |
Ring members by |
A ring health SLI (unhealthy members should be 0):
sum by (name) (loki_ring_members{state="Unhealthy"})
Compactor¶
The compactor merges TSDB index files and applies retention.
Metric |
Type |
Description |
|---|---|---|
|
Gauge |
Duration of retention application |
|
Gauge |
Timestamp of the last successful retention run |
|
Counter |
Table compaction operations by |