commit 04ecc4e6f0e4cfe351df9c60d5e14e05e7729482 parent 730ec3c6b7d6cd6a1e23403a61cfdf723f4eb691 Author: mtmn <miro@haravara.org> Date: Tue, 7 Apr 2026 12:31:21 +0200 modules/services/monitoring.nix Diffstat:
| M | modules/services/monitoring.nix | | | 57 | +++++++++++++++++++++++++++------------------------------ |
1 file changed, 27 insertions(+), 30 deletions(-)
diff --git a/modules/services/monitoring.nix b/modules/services/monitoring.nix @@ -323,39 +323,36 @@ in { }; }; - promtail = { + alloy = { enable = true; - configuration = { - server = { - http_listen_address = "127.0.0.1"; - http_listen_port = 9080; - grpc_listen_address = "127.0.0.1"; - grpc_listen_port = 0; - }; - clients = [ - { - url = "http://127.0.0.1:3100/loki/api/v1/push"; + enableStreamParsing = true; + arguments = { + server.http.listen-addr = "127.0.0.1"; + server.http.listen-port = 12345; + }; + config.content = builtins.toFile "alloy-config.river" '' + loki.source.journal "systemd_logs" { + max_age = "12h" + format_as_json = false + + forward_to = [loki.write.default.receiver] + + relabel { + source_labels = ["__journal__systemd_unit"] + target_label = "unit" } - ]; - scrape_configs = [ - { - job_name = "journal"; - journal = { - max_age = "12h"; - labels = { - job = "systemd-journal"; - host = config.networking.hostName; - }; - }; - relabel_configs = [ - { - source_labels = ["__journal__systemd_unit"]; - target_label = "unit"; - } - ]; + } + + loki.write "default" { + endpoint { + url = "http://127.0.0.1:3100/loki/api/v1/push" } - ]; - }; + external_labels { + host = "${config.networking.hostName}" + job = "systemd-journal" + } + } + ''; }; grafana = {