From dd1adf7368dd67cbcd7712640faabce92c42dc6c Mon Sep 17 00:00:00 2001 From: Giacomo Sanchietti Date: Wed, 6 Mar 2024 09:19:38 +0100 Subject: [PATCH] grafana: add logs dashboard --- imageroot/etc/dashboards/logs.yml | 314 ++++++++++++++++++++++++++++++ 1 file changed, 314 insertions(+) create mode 100644 imageroot/etc/dashboards/logs.yml diff --git a/imageroot/etc/dashboards/logs.yml b/imageroot/etc/dashboards/logs.yml new file mode 100644 index 0000000..b9fd02e --- /dev/null +++ b/imageroot/etc/dashboards/logs.yml @@ -0,0 +1,314 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Loki dashboard with quick search and timeline.", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 13186, + "graphTooltip": 0, + "id": 3, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short", + "unitScale": true + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "timezone": [ + "", + "" + ], + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "10.3.3", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "editorMode": "code", + "expr": "sum(count_over_time({hostname=~\"$hostname\", application=~\"$application\", level=~\"$level\"} |~ \"$search\"[$__interval]))", + "legendFormat": "messages", + "queryType": "range", + "refId": "A" + } + ], + "title": "Timeline", + "type": "timeseries" + }, + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "gridPos": { + "h": 25, + "w": 24, + "x": 0, + "y": 3 + }, + "id": 2, + "maxDataPoints": "", + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": true, + "showCommonLabels": true, + "showLabels": true, + "showTime": true, + "sortOrder": "Descending", + "wrapLogMessage": true + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "editorMode": "code", + "expr": "{hostname=~\"$hostname\", application=~\"$application\", level=~\"$level\"} |~ \"$search\"", + "legendFormat": "", + "queryType": "range", + "refId": "A" + } + ], + "title": "Logs", + "type": "logs" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [ + { + "allValue": ".+", + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "loki", + "uid": "loki" + }, + "definition": "", + "hide": 0, + "includeAll": true, + "label": "Hostname", + "multi": false, + "name": "hostname", + "options": [], + "query": { + "label": "hostname", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allValue": ".*", + "current": { + "selected": true, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "loki", + "uid": "loki" + }, + "definition": "", + "hide": 0, + "includeAll": true, + "label": "Application", + "multi": false, + "name": "application", + "options": [], + "query": { + "label": "application", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": ".*", + "current": { + "selected": true, + "text": [ + "error" + ], + "value": [ + "error" + ] + }, + "datasource": { + "type": "loki", + "uid": "loki" + }, + "definition": "", + "hide": 0, + "includeAll": true, + "label": "Level", + "multi": false, + "name": "level", + "options": [], + "query": { + "label": "level", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "", + "value": "" + }, + "hide": 0, + "name": "search", + "options": [ + { + "selected": true, + "text": "", + "value": "" + } + ], + "query": ".*", + "skipUrlSync": false, + "type": "textbox" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "Logs", + "uid": "liz0yRCZz", + "version": 17, + "weekStart": "" +}