grafana: extract MESSAGE field in log panels
All checks were successful
Run nix flake check / flake-check (push) Successful in 2m5s
All checks were successful
Run nix flake check / flake-check (push) Successful in 2m5s
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 <noreply@anthropic.com>
This commit is contained in:
@@ -208,7 +208,7 @@
|
|||||||
"datasource": {"type": "loki", "uid": "loki"},
|
"datasource": {"type": "loki", "uid": "loki"},
|
||||||
"targets": [
|
"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"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
"datasource": {"type": "loki", "uid": "loki"},
|
"datasource": {"type": "loki", "uid": "loki"},
|
||||||
"targets": [
|
"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"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
"datasource": {"type": "loki", "uid": "loki"},
|
"datasource": {"type": "loki", "uid": "loki"},
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "{job=\"bootstrap\", host=~\"$host\"}",
|
"expr": "{job=\"bootstrap\", host=~\"$host\"} | json | line_format \"{{.MESSAGE}}\"",
|
||||||
"refId": "A"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
"datasource": {"type": "loki", "uid": "loki"},
|
"datasource": {"type": "loki", "uid": "loki"},
|
||||||
"targets": [
|
"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"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user