From 5d68662035be696dcc577c1b9adf4bf55d11a675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Fri, 13 Feb 2026 23:55:27 +0100 Subject: [PATCH] loki: add 30-day retention policy and ingestion limits Enable compactor-based retention with 30-day period to prevent unbounded disk growth. Add basic rate limits and stream guards to protect against runaway log generators. Co-Authored-By: Claude Opus 4.6 --- services/monitoring/loki.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/services/monitoring/loki.nix b/services/monitoring/loki.nix index bf37f87..87ee06f 100644 --- a/services/monitoring/loki.nix +++ b/services/monitoring/loki.nix @@ -37,6 +37,22 @@ directory = "/var/lib/loki/chunks"; }; }; + compactor = { + working_directory = "/var/lib/loki/compactor"; + compaction_interval = "10m"; + retention_enabled = true; + retention_delete_delay = "2h"; + retention_delete_worker_count = 150; + delete_request_store = "filesystem"; + }; + limits_config = { + retention_period = "30d"; + ingestion_rate_mb = 10; + ingestion_burst_size_mb = 20; + max_streams_per_user = 10000; + max_query_series = 500; + max_query_parallelism = 8; + }; }; }; }