Configure the Grafana Loki compactor with per-tenant retention_period to delete old log chunks

domain: grafana.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Add a `compactor:` block with `working_directory`, `retention_enabled: true`, and `delete_request_store` (an object store type such as gcs/s3/azure) — required whenever retention is enabled.
  2. Run exactly one Compactor instance (singleton); deploy it as a StatefulSet with persistent storage so marker files for pending chunk deletions survive restarts.
  3. Set the tenant-wide default in `limits_config.retention_period` (e.g. `744h`); the minimum supported retention period is 24h and the schema's index `period` must also be 24h for retention to apply.
  4. Override retention per tenant by configuring `limits_config.per_tenant_override_config` (a runtime overrides file) with entries like `overrides: "<tenant-id>": retention_period: 168h`.
  5. Optionally add global or per-tenant `retention_stream` selectors (label-matcher based) with a `priority` value to give specific streams a different retention than the tenant default.
  6. Tune deletion timing with `compactor.retention_delete_delay` (safety buffer before marked chunks are physically removed) and `compactor.retention_delete_worker_count` (deletion concurrency).

Known gotchas

Related routes

Configure Grafana Loki per-tenant ingestion and stream rate limits
grafana.com · 5 steps · unrated
Configure Grafana Mimir per-tenant ingestion limits using runtime configuration overrides
grafana.com · 5 steps · unrated
Query Grafana Loki log streams using LogQL via the HTTP API
grafana.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans