From 99c43c145e0e142997dec88ec803fb827b72eaa1 Mon Sep 17 00:00:00 2001 From: Christine Elisabeth Koppel Date: Sat, 14 Feb 2026 17:09:50 +0100 Subject: [PATCH] Wrong format.. --- .../modules/system/gramethus.nix | 63 ++++++++----------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/nix-system-configs/modules/system/gramethus.nix b/nix-system-configs/modules/system/gramethus.nix index 6e4ddbf..105fcf7 100644 --- a/nix-system-configs/modules/system/gramethus.nix +++ b/nix-system-configs/modules/system/gramethus.nix @@ -177,51 +177,42 @@ in { environment.etc."alloy/config.alloy" = { text = '' - server: - http_listen_port: 28183 - grpc_listen_port: 0 + loki.relabel "journal" { + rule { + source_labels = ["__journal__systemd_unit"] + target_label = "unit" + } + } - logs: - # keep positions persistent on disk (don't use /tmp in production) - positions: - filename: /var/lib/grafana-agent/positions.yaml + loki.write "local" { + endpoint { + url = "http://127.0.0.1:3100/loki/api/v1/push" + } + external_labels = {} + } - configs: - - name: journal - journal: - # keep similar rotation / lookback to your promtail config - max_age: 12h - labels: - job: systemd-journal - host: chrysalis + loki.source.journal "journal" { + max_age = "12h0m0s" - clients: - - url: http://127.0.0.1:3100/loki/api/v1/push + forward_to = [loki.write.local.receiver] - relabel_configs: - - source_labels: ["__journal__systemd_unit"] - target_label: "unit" + labels = { + job = "systemd-journal" + host = "chrysalis" + } + + relabel_rules = loki.relabel.journal.rules + + legacy_position { + file = "/var/lib/grafana-agent/positions.yaml" + name = "journal" + } + } ''; group = "root"; mode = "0644"; }; - # Add a simple systemd service to run the Grafana Agent (Alloy) - systemd.services.grafana-agent = { - description = "Grafana Alloy"; - wantedBy = ["multi-user.target"]; - - serviceConfig = { - # The grafana-agent binary provided by nixpkgs - ExecStart = '' - ${pkgs.grafana-alloy}/bin/alloy run - ''; - - Restart = "on-failure"; - RestartSec = "5s"; - }; - }; - # or alternatively #configFile = ./loki-config.yaml; # };