fix(loki): enforce retention via the compactor, keep 365 days #1532

Merged
k.renner merged 1 commits from worktree-loki-retention-365d into main 2026-10-31 06:10:42 +00:00
Member

limits_config.retention_period was set to 2160h, but nothing enforced it. Loki deletes data only through the compactor with retention_enabled: true, and the deployed config has no compactor block. As a result Loki keeps everything: logs from 2026-05-15 are still queryable.

Changes in kubernetes/apps/monitoring/helmrelease-loki.yaml:

  • Enable compactor retention: retention_enabled: true, delete_request_store: filesystem, working_directory: /var/loki/compactor (on the existing PVC).
  • Raise retention_period from 2160h to 8760h (365 days).

On its first run the compactor deletes everything older than 365 days. Today that is nothing, because the oldest data is from 2026-05-15.

Sizing: storage-loki-0 holds 21.3 GiB of 80 GiB after about 5.5 months. That averages ~0.13 GiB/day; the rate over 22.–25.10 was ~0.23 GiB/day. At the recent rate, 365 days comes to about 84 GiB, so the PVC may need to grow later (ceph-block has allowVolumeExpansion: true).

Rendered with chart loki 7.5.0 (the deployed version); grafana/loki:3.6.11 -verify-config reports "config is valid".

🤖 Generated with Claude Code

`limits_config.retention_period` was set to 2160h, but nothing enforced it. Loki deletes data only through the compactor with `retention_enabled: true`, and the deployed config has no `compactor` block. As a result Loki keeps everything: logs from 2026-05-15 are still queryable. Changes in `kubernetes/apps/monitoring/helmrelease-loki.yaml`: - Enable compactor retention: `retention_enabled: true`, `delete_request_store: filesystem`, `working_directory: /var/loki/compactor` (on the existing PVC). - Raise `retention_period` from `2160h` to `8760h` (365 days). On its first run the compactor deletes everything older than 365 days. Today that is nothing, because the oldest data is from 2026-05-15. Sizing: `storage-loki-0` holds 21.3 GiB of 80 GiB after about 5.5 months. That averages ~0.13 GiB/day; the rate over 22.–25.10 was ~0.23 GiB/day. At the recent rate, 365 days comes to about 84 GiB, so the PVC may need to grow later (`ceph-block` has `allowVolumeExpansion: true`). Rendered with chart `loki` 7.5.0 (the deployed version); `grafana/loki:3.6.11 -verify-config` reports "config is valid". 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude-bot added 1 commit 2026-10-30 13:38:39 +00:00
fix(loki): enforce retention via the compactor, keep 365 days
ci/woodpecker/pr/ci-manifests-test Pipeline was successful
ci/woodpecker/pr/ci-scripts-test Pipeline was successful
c9944cfce8
limits_config.retention_period was set (2160h) but never enforced: the
live config has no compactor block, so retention_enabled is false and
Loki keeps everything (logs from 2026-05-15 are still queryable).

Enable compactor retention (working_directory under the existing
/var/loki PVC, delete_request_store filesystem) and raise the period to
365 days.

Sizing: storage-loki-0 holds 21.3 GiB of 80 GiB after 5.5 months
(~0.13 GiB/day average, ~0.23 GiB/day over 22.-25.10). 365 days at the
recent rate is ~84 GiB, so the PVC may need expanding later
(ceph-block allows volume expansion).

Rendered with chart loki 7.5.0 and checked with
`loki:3.6.11 -verify-config`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k.renner merged commit 53d7e716f8 into main 2026-10-31 06:10:42 +00:00
Sign in to join this conversation.