From e6bfb11be0313379ea09272b4d7fcda6897922ce Mon Sep 17 00:00:00 2001 From: sid Date: Fri, 22 May 2026 19:20:36 +0200 Subject: [PATCH] grafana: add logs dashboard --- modules/nixos/loki/dashboards/logs.json | 75 +++++++++++++++++++++++++ modules/nixos/loki/default.nix | 7 +++ 2 files changed, 82 insertions(+) create mode 100644 modules/nixos/loki/dashboards/logs.json diff --git a/modules/nixos/loki/dashboards/logs.json b/modules/nixos/loki/dashboards/logs.json new file mode 100644 index 0000000..b929e9b --- /dev/null +++ b/modules/nixos/loki/dashboards/logs.json @@ -0,0 +1,75 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Graphics --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 1, + "links": [], + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "Loki" + }, + "gridPos": { + "h": 24, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": true, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "Loki" + }, + "expr": "{job=\"systemd-journal\"}", + "refId": "A" + } + ], + "title": "System Logs", + "type": "logs" + } + ], + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "System Logs", + "uid": "system-logs", + "version": 1 +} diff --git a/modules/nixos/loki/default.nix b/modules/nixos/loki/default.nix index d5261e6..f6f6045 100644 --- a/modules/nixos/loki/default.nix +++ b/modules/nixos/loki/default.nix @@ -60,6 +60,13 @@ access = "proxy"; url = "http://127.0.0.1:3100"; isDefault = true; + uid = "Loki"; + } + ]; + dashboards.settings.providers = [ + { + name = "default"; + options.path = ./dashboards; } ]; };