iac/ansible/roles/monitoring/templates/loki.yml.j2
Sergei Poljanski 27d4b73eb0
Some checks failed
deploy / ansible (push) Has been cancelled
monitoring: keep Loki chunks in S3, 90 days of logs and metrics
ops has 12 GB free on a 38 GB disk and the Traefik access log alone
is ~600 MB, so logs can't grow there. From 2026-11-14 Loki writes
chunks and index to Hetzner Object Storage (asxpio-loki-main, hel1)
with the existing project key, passed through loki.env and
-config.expand-env. Today's filesystem period ages out by retention.

Log retention goes from 14 to 90 days. Prometheus metrics are small
(~20 MB so far) and stay local, now for 90 days instead of 30.

Assisted-by: Claude:opus-5-5
2026-11-13 07:04:00 +04:00

53 lines
1.3 KiB
Django/Jinja

# Managed by Ansible (role monitoring).
auth_enabled: false
server:
http_listen_port: 3100
log_level: warn
common:
path_prefix: /loki
replication_factor: 1
ring:
kvstore:
store: inmemory
storage:
filesystem:
chunks_directory: /loki/chunks
rules_directory: /loki/rules
schema_config:
configs:
- from: "2026-11-01"
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
# From here on chunks and index live in Hetzner Object Storage, not on
# ops' small disk. The filesystem period above ages out with retention.
- from: "2026-11-14"
store: tsdb
object_store: aws
schema: v13
index:
prefix: index_
period: 24h
storage_config:
aws:
endpoint: {{ s3_region }}.your-objectstorage.com
region: {{ s3_region }}
bucketnames: {{ s3_bucket_loki }}
access_key_id: ${S3_ACCESS_KEY}
secret_access_key: ${S3_SECRET_KEY}
limits_config:
retention_period: {{ monitoring_logs_retention }}
reject_old_samples: true
reject_old_samples_max_age: 168h
ingestion_rate_mb: 8
ingestion_burst_size_mb: 16
volume_enabled: true
compactor:
working_directory: /loki/compactor
retention_enabled: true
delete_request_store: aws
analytics:
reporting_enabled: false