# Loki single-binary, filesystem storage, tsdb schema, 90d retention via compactor. # Localhost only — Grafana is the sole consumer. { config, lib, ... }: let cfg = config.my.profiles.monitoring; in { config = lib.mkIf cfg.enable { services.loki = { enable = true; configuration = { server = { http_listen_address = "127.0.0.1"; http_listen_port = 3100; }; auth_enabled = false; common = { instance_addr = "127.0.0.1"; path_prefix = "/var/lib/loki"; storage.filesystem = { chunks_directory = "/var/lib/loki/chunks"; rules_directory = "/var/lib/loki/rules"; }; replication_factor = 1; ring.kvstore.store = "inmemory"; }; schema_config.configs = [ { from = "2024-01-01"; store = "tsdb"; object_store = "filesystem"; schema = "v13"; index = { prefix = "index_"; period = "24h"; }; } ]; limits_config.retention_period = "2160h"; # 90d compactor = { working_directory = "/var/lib/loki/compactor"; retention_enabled = true; delete_request_store = "filesystem"; }; }; }; }; }