From 60f7042211f05463b766294ca368017e535eac16 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Thu, 30 May 2024 14:18:41 -0700 Subject: [PATCH] fix(monitoring): loki ingest config --- modules/nixos/monitoring/ingest/loki.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/nixos/monitoring/ingest/loki.nix b/modules/nixos/monitoring/ingest/loki.nix index 0aedca73..cb29ecd4 100644 --- a/modules/nixos/monitoring/ingest/loki.nix +++ b/modules/nixos/monitoring/ingest/loki.nix @@ -7,11 +7,12 @@ ... }: let inherit (gensokyo-zone) systems; - inherit (lib.attrsets) filterAttrs mapAttrsToList attrNames; + inherit (lib.attrsets) filterAttrs mapAttrsToList; promtailSystems = filterAttrs ( _: system: - system.config.exporters.promtail.enable or false + system.config.access.online.enable + && system.config.exports.services.promtail.enable ) systems; inherit (builtins) toJSON; @@ -46,15 +47,15 @@ in { filename = "/tmp/positions.yaml"; }; clients = - mapAttrsToList (system: systemConfig: { - url = "${access.getAddressFor system.config.name "local"}:${system.config.exporters.promtail.port}"; + mapAttrsToList (_: system: { + url = "${access.getAddressFor system.config.name "lan"}:${toString system.config.exports.services.promtail.ports.default.port}"; }) promtailSystems; scrape_configs = - mapAttrsToList (system: systemConfig: { + mapAttrsToList (_: system: { job_name = "${system.config.name}-journal"; journal = { - max_age = "${24 * 7}h"; + max_age = "${toString (24 * 7)}h"; labels = { job = "systemd-journal"; host = system.config.name;