commit 7796336a406b0a074ce4004d5c9b597ad06c2878
parent 88d7ccc4ee66ab82d63683cad263e2cf10cb5690
Author: mtmn <miro@haravara.org>
Date: Tue, 7 Apr 2026 18:58:21 +0200
feat: add gurk, alloy config
Diffstat:
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/modules/services/monitoring.nix b/modules/services/monitoring.nix
@@ -326,6 +326,12 @@ in {
alloy = {
enable = true;
configPath = pkgs.writeText "alloy-config.river" ''
+ loki.write "default" {
+ endpoint {
+ url = "http://127.0.0.1:3100/loki/api/v1/push"
+ }
+ }
+
loki.relabel "journal" {
forward_to = [loki.write.default.receiver]
@@ -333,20 +339,29 @@ in {
source_labels = ["__journal__systemd_unit"]
target_label = "unit"
}
+
+ rule {
+ source_labels = ["__journal__comm"]
+ target_label = "process"
+ }
+
+ rule {
+ source_labels = ["__journal__priority"]
+ target_label = "level"
+ }
+
+ rule {
+ source_labels = ["__journal__syslog_identifier"]
+ target_label = "app"
+ }
}
loki.source.journal "systemd_logs" {
max_age = "12h"
forward_to = [loki.relabel.journal.receiver]
labels = {
- job = "systemd-journal"
- host = "${config.networking.hostName}"
- }
- }
-
- loki.write "default" {
- endpoint {
- url = "http://127.0.0.1:3100/loki/api/v1/push"
+ job = "systemd-journal",
+ host = "${config.networking.hostName}",
}
}
'';