From b076c606b67491fcc3735288aafbd53489474157 Mon Sep 17 00:00:00 2001
From: Maarten de Waard <maarten@greenhost.nl>
Date: Mon, 9 Aug 2021 11:37:46 +0200
Subject: [PATCH] update and configure loki for 48h retention with compactor

---
 flux2/apps/monitoring/loki-release.yaml          |  2 +-
 flux2/apps/monitoring/loki-values-configmap.yaml | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/flux2/apps/monitoring/loki-release.yaml b/flux2/apps/monitoring/loki-release.yaml
index fb5bf1b62..ce04d3cb0 100644
--- a/flux2/apps/monitoring/loki-release.yaml
+++ b/flux2/apps/monitoring/loki-release.yaml
@@ -10,7 +10,7 @@ spec:
     spec:
       # https://artifacthub.io/packages/helm/grafana/loki
       chart: loki
-      version: 2.5.2
+      version: 2.6.0
       sourceRef:
         kind: HelmRepository
         name: grafana
diff --git a/flux2/apps/monitoring/loki-values-configmap.yaml b/flux2/apps/monitoring/loki-values-configmap.yaml
index 293aea932..677be197d 100644
--- a/flux2/apps/monitoring/loki-values-configmap.yaml
+++ b/flux2/apps/monitoring/loki-values-configmap.yaml
@@ -49,14 +49,20 @@ data:
           shared_store: filesystem
         filesystem:
           directory: /data/loki/chunks
+      # https://grafana.com/docs/loki/v2.3.0/operations/storage/retention/#retention-configuration^B
       compactor:
         working_directory: /data/loki/boltdb-shipper-compactor
         shared_store: filesystem
+        compaction_interval: 10m
+        retention_enabled: true
+        retention_delete_delay: 2h
+        retention_delete_worker_count: 150
       limits_config:
+        retention_period: 48h # 2 days
         reject_old_samples: true
-        reject_old_samples_max_age: 168h  # 7 days
+        reject_old_samples_max_age: 48h  # 2 days
       chunk_store_config:
-        max_look_back_period: 168h  # 7 days
+        max_look_back_period: 48h  # 2 days
       table_manager:
         retention_deletes_enabled: true
-        retention_period: 168h  # 7 days
+        retention_period: 48h  # 7 days
-- 
GitLab