apiVersion: v1 kind: ConfigMap metadata: name: loki-logs-dashboard namespace: monitoring labels: grafana_dashboard: "1" data: loki-logs-dashboard.json: |- { "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "editable": true, "gnetId": null, "graphTooltip": 0, "id": null, "links": [], "panels": [ { "datasource": "Loki", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "bars", "fillOpacity": 100, "gradientMode": "none", "hideFrom": { "tooltip": false, "viz": false, "legend": false }, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, "scaleDistribution": { "type": "linear" }, "showPoints": "never", "spanNulls": false, "stacking": { "group": "A", "mode": "normal" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 8, "w": 24, "x": 0, "y": 0 }, "id": 2, "options": { "legend": { "calcs": [], "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi" } }, "pluginVersion": "8.0.0", "targets": [ { "expr": "sum by (namespace) (rate({namespace=~\".+\"}[1m]))", "refId": "A" } ], "title": "Log Rate by Namespace (logs/sec)", "type": "timeseries" }, { "datasource": "Loki", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "bars", "fillOpacity": 100, "gradientMode": "none", "hideFrom": { "tooltip": false, "viz": false, "legend": false }, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, "scaleDistribution": { "type": "linear" }, "showPoints": "never", "spanNulls": false, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 }, "id": 4, "options": { "legend": { "calcs": ["last"], "displayMode": "table", "placement": "right" }, "tooltip": { "mode": "multi" } }, "pluginVersion": "8.0.0", "targets": [ { "expr": "sum by (namespace) (rate({namespace=~\".+\"} |~ \"(?i)error|exception|fatal\"[5m]))", "refId": "A" } ], "title": "Error Rate by Namespace", "type": "timeseries" }, { "datasource": "Loki", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 10 }, { "color": "red", "value": 50 } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 }, "id": 6, "options": { "orientation": "auto", "reduceOptions": { "values": false, "calcs": [ "lastNotNull" ], "fields": "" }, "showThresholdLabels": false, "showThresholdMarkers": true, "text": {} }, "pluginVersion": "8.0.0", "targets": [ { "expr": "sum(count_over_time({namespace=~\".+\"} |~ \"(?i)error|exception|fatal\"[1h]))", "refId": "A" } ], "title": "Total Errors (Last Hour)", "type": "gauge" }, { "datasource": "Loki", "gridPos": { "h": 12, "w": 24, "x": 0, "y": 16 }, "id": 8, "options": { "dedupStrategy": "none", "enableLogDetails": true, "prettifyLogMessage": false, "showCommonLabels": false, "showLabels": false, "showTime": true, "sortOrder": "Descending", "wrapLogMessage": false }, "targets": [ { "expr": "{namespace=~\"$namespace\", pod=~\"$pod\"} |~ \"$search\"", "refId": "A" } ], "title": "Log Browser", "type": "logs" }, { "datasource": "Loki", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "hideFrom": { "tooltip": false, "viz": false, "legend": false } }, "mappings": [] }, "overrides": [] }, "gridPos": { "h": 10, "w": 12, "x": 0, "y": 28 }, "id": 10, "options": { "legend": { "displayMode": "table", "placement": "right", "values": ["value"] }, "pieType": "pie", "tooltip": { "mode": "single" } }, "pluginVersion": "8.0.0", "targets": [ { "expr": "topk(10, sum by (namespace) (count_over_time({namespace=~\".+\"}[1h])))", "refId": "A" } ], "title": "Top 10 Namespaces by Log Volume", "type": "piechart" }, { "datasource": "Loki", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "hideFrom": { "tooltip": false, "viz": false, "legend": false } }, "mappings": [] }, "overrides": [] }, "gridPos": { "h": 10, "w": 12, "x": 12, "y": 28 }, "id": 12, "options": { "legend": { "displayMode": "table", "placement": "right", "values": ["value"] }, "pieType": "pie", "tooltip": { "mode": "single" } }, "pluginVersion": "8.0.0", "targets": [ { "expr": "topk(10, sum by (pod) (count_over_time({namespace=~\"$namespace\"}[1h])))", "refId": "A" } ], "title": "Top 10 Pods by Log Volume", "type": "piechart" }, { "datasource": "Loki", "gridPos": { "h": 10, "w": 24, "x": 0, "y": 38 }, "id": 14, "options": { "dedupStrategy": "none", "enableLogDetails": true, "prettifyLogMessage": false, "showCommonLabels": false, "showLabels": true, "showTime": true, "sortOrder": "Descending", "wrapLogMessage": true }, "targets": [ { "expr": "{namespace=~\".+\"} |~ \"(?i)error|exception|fatal|warn\"", "refId": "A" } ], "title": "Errors & Warnings (All Namespaces)", "type": "logs" } ], "refresh": "10s", "schemaVersion": 27, "style": "dark", "tags": ["loki", "logs"], "templating": { "list": [ { "allValue": ".+", "current": { "selected": false, "text": "All", "value": "$__all" }, "datasource": "Loki", "definition": "label_values(namespace)", "hide": 0, "includeAll": true, "label": "Namespace", "multi": true, "name": "namespace", "options": [], "query": "label_values(namespace)", "refresh": 1, "regex": "", "skipUrlSync": false, "sort": 1, "type": "query" }, { "allValue": ".+", "current": { "selected": false, "text": "All", "value": "$__all" }, "datasource": "Loki", "definition": "label_values({namespace=~\"$namespace\"}, pod)", "hide": 0, "includeAll": true, "label": "Pod", "multi": true, "name": "pod", "options": [], "query": "label_values({namespace=~\"$namespace\"}, pod)", "refresh": 1, "regex": "", "skipUrlSync": false, "sort": 1, "type": "query" }, { "current": { "selected": false, "text": "", "value": "" }, "hide": 0, "label": "Search", "name": "search", "options": [ { "selected": true, "text": "", "value": "" } ], "query": "", "skipUrlSync": false, "type": "textbox" } ] }, "time": { "from": "now-1h", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Loki Logs Dashboard", "uid": "loki-logs", "version": 1 }