diff --git a/.env.sample b/.env.sample index 79335e9..7783f35 100644 --- a/.env.sample +++ b/.env.sample @@ -29,6 +29,9 @@ DOMAIN=monitoring.example.com # Loki Server # # COMPOSE_FILE="$COMPOSE_FILE:compose.loki.yml" +# +# Set to 0 to disable retention +# LOKI_RETENTION_PERIOD=744h # LOKI_STORAGE_FILESYSTEM=1 # ## S3 Storage diff --git a/compose.loki.yml b/compose.loki.yml index 68685f9..f5ec027 100644 --- a/compose.loki.yml +++ b/compose.loki.yml @@ -2,7 +2,7 @@ version: '3.8' services: loki: - image: grafana/loki:2.0.0 + image: grafana/loki:2.8.2 # entrypoint: 'tail -f /dev/null' command: -config.file=/etc/loki/local-config.yaml networks: @@ -19,6 +19,7 @@ services: - LOKI_AWS_ENDPOINT - LOKI_AWS_REGION - LOKI_BUCKET_NAMES + - LOKI_RETENTION_PERIOD - STACK_NAME - LOKI_STORAGE_FILESYSTEM - LOKI_STORAGE_S3 diff --git a/loki.yml.tmpl b/loki.yml.tmpl index 679dabe..44598b2 100644 --- a/loki.yml.tmpl +++ b/loki.yml.tmpl @@ -34,7 +34,8 @@ ingester: chunk_target_size: 1048576 # Loki will attempt to build chunks up to 1.5MB, flushing first if chunk_idle_period or max_chunk_age is reached first chunk_retain_period: 30s # Must be greater than index read cache TTL if using an index cache (Default index read cache TTL is 5m) max_transfer_retries: 0 # Chunk transfers disabled - + wal: + dir: "/tmp/wal" memberlist: abort_if_cluster_join_fails: false @@ -102,11 +103,16 @@ storage_config: compactor: working_directory: /loki/boltdb-shipper-compactor shared_store: filesystem + compaction_interval: 10m + retention_enabled: true + retention_delete_delay: 2h + retention_delete_worker_count: 150 limits_config: enforce_metric_name: false reject_old_samples: true reject_old_samples_max_age: 168h + retention_period: {{ env "LOKI_RETENTION_PERIOD" }} chunk_store_config: max_look_back_period: 0s