From c64d299daf1d6c698a35adc687bc8a02a60d1453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sun, 8 Feb 2026 21:50:47 +0100 Subject: [PATCH] grafana: extract MESSAGE field in log panels Use LogQL json parser and line_format to show only the MESSAGE field instead of the full JSON blob in log panels. Co-Authored-By: Claude Opus 4.5 --- services/grafana/dashboards/nixos-operations.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/grafana/dashboards/nixos-operations.json b/services/grafana/dashboards/nixos-operations.json index 0a7ef84..628b8a8 100644 --- a/services/grafana/dashboards/nixos-operations.json +++ b/services/grafana/dashboards/nixos-operations.json @@ -208,7 +208,7 @@ "datasource": {"type": "loki", "uid": "loki"}, "targets": [ { - "expr": "{systemd_unit=\"nixos-upgrade.service\", host=~\"$host\"} |= \"Done. The new configuration is\"", + "expr": "{systemd_unit=\"nixos-upgrade.service\", host=~\"$host\"} |= \"Done. The new configuration is\" | json | line_format \"{{.MESSAGE}}\"", "refId": "A" } ], @@ -231,7 +231,7 @@ "datasource": {"type": "loki", "uid": "loki"}, "targets": [ { - "expr": "{systemd_unit=\"nixos-upgrade.service\", host=~\"$host\"} |= \"building\"", + "expr": "{systemd_unit=\"nixos-upgrade.service\", host=~\"$host\"} |= \"building\" | json | line_format \"{{.MESSAGE}}\"", "refId": "A" } ], @@ -254,7 +254,7 @@ "datasource": {"type": "loki", "uid": "loki"}, "targets": [ { - "expr": "{job=\"bootstrap\", host=~\"$host\"}", + "expr": "{job=\"bootstrap\", host=~\"$host\"} | json | line_format \"{{.MESSAGE}}\"", "refId": "A" } ], @@ -277,7 +277,7 @@ "datasource": {"type": "loki", "uid": "loki"}, "targets": [ { - "expr": "{systemd_unit=\"nixos-upgrade.service\", host=~\"$host\"} |~ \"(?i)error|failed\"", + "expr": "{systemd_unit=\"nixos-upgrade.service\", host=~\"$host\"} |~ \"(?i)error|failed\" | json | line_format \"{{.MESSAGE}}\"", "refId": "A" } ],