homek8s/infrastructure/logging/loki/config.yaml
Lance Walters 179257d8fb infra(logging): Loki single-binary + Alloy DaemonSet, 192h bounded retention (F4)
No log store existed: pod logs were kubelet files on the node and died with the
pod (~8h deepest history for a busy workload). Adds:

- Loki 3.7.1 single-binary (1 Deployment + 8Gi local-path PVC on siriussec),
  retention_period 192h with the compactor deleting on filesystem, ingest rate
  limits, so the store is time- and rate-bounded.
- Alloy 1.13.0 DaemonSet (all nodes, no RBAC, no API access) shipping
  /var/log/pods, /var/log/journal and the Pi's docker json logs. File sources
  read from byte 0 and stamp the timestamp from the line, so the history the
  nodes already held (18d cilium on linode, 31d registry on rpi) landed on day
  one instead of starting the 7-day clock at deploy time.
- Grafana datasource (uid loki) via the existing sidecar, ServiceMonitor,
  ingest-rate guard rule.
- docs/logging.md with the measured bytes/day, the 8-day projection and the
  runbook.

Measured: ~360-502 MB/day raw -> ~90 MB/day compressed, 192h -> <=0.8GiB, on a
node with 103GiB free (house floor 32GiB). Verified 7-day-old lines return for
kube-system cilium-agent and for the siriussec/linode journals, and survive a
Loki pod restart (PVC).
2026-11-27 00:36:56 -05:00

82 lines
2.4 KiB
YAML

# Loki single-binary configuration.
#
# Why single-binary and not the microservices chart: this is a 3-node house
# cluster whose entire log volume is well under 1 GiB/day. One process, one
# PVC, no object store, no ring to babysit.
#
# Retention: `retention_period: 192h` (8 days) — the deliverable is a *7-day
# floor*, and the compactor deletes relative to "now", so a 7-day-old line has
# a full day of margin before the compactor would touch it. 168h would put the
# 7-day boundary exactly on the deletion edge, which makes the acceptance query
# flaky. 192h is still a hard bound, not "keep everything".
#
# Storage is bounded three ways: (1) the 8Gi PVC, (2) compactor retention
# deleting whole chunks past 192h, (3) ingestion rate limits + a per-stream
# rate limit so one noisy pod cannot outrun deletion.
auth_enabled: false
server:
http_listen_address: 0.0.0.0
http_listen_port: 3100
grpc_listen_port: 9096
log_level: info
common:
instance_addr: 127.0.0.1
path_prefix: /loki
storage:
filesystem:
chunks_directory: /loki/chunks
rules_directory: /loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
schema_config:
configs:
- from: 2026-01-01
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
storage_config:
tsdb_shipper:
active_index_directory: /loki/tsdb-index
cache_location: /loki/tsdb-cache
limits_config:
# The floor. Compactor deletes anything older; nothing re-creates it.
retention_period: 192h
# Backfill is deliberate (pre-existing kubelet files + node journals carry
# real historical timestamps), so accept samples up to the retention horizon.
reject_old_samples: true
reject_old_samples_max_age: 192h
ingestion_rate_mb: 8
ingestion_burst_size_mb: 16
per_stream_rate_limit: 3MB
per_stream_rate_limit_burst: 6MB
max_streams_per_user: 10000
max_entries_limit_per_query: 5000
allow_structured_metadata: true
volume_enabled: true
# One day per sub-query keeps the single-binary querier inside its memory
# limit when someone scans a full week.
split_queries_by_interval: 24h
max_query_parallelism: 8
query_timeout: 2m
compactor:
working_directory: /loki/compactor
compaction_interval: 10m
retention_enabled: true
delete_request_store: filesystem
retention_delete_delay: 2h
retention_delete_worker_count: 150
analytics:
reporting_enabled: false