diff --git a/ansible/roles/grafana/files/dashboards/logs-aprs.json b/ansible/roles/grafana/files/dashboards/logs-aprs.json new file mode 100644 index 0000000..7f9d3cd --- /dev/null +++ b/ansible/roles/grafana/files/dashboards/logs-aprs.json @@ -0,0 +1,437 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Pod logs for the APRS.me app in the home-cluster, sourced from Loki.", + "editable": true, + "graphTooltip": 0, + "tags": [ + "logs", + "loki", + "aprs" + ], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "Loki", + "value": "Loki" + }, + "hide": 0, + "includeAll": false, + "label": "Datasource", + "multi": false, + "name": "datasource", + "options": [], + "query": "loki", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"aprs\"}, pod)", + "hide": 0, + "includeAll": true, + "label": "Pod", + "multi": true, + "name": "pod", + "query": { + "query": "label_values({namespace=\"aprs\"}, pod)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "pod" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"aprs\"}, container)", + "hide": 0, + "includeAll": true, + "label": "Container", + "multi": true, + "name": "container", + "query": { + "query": "label_values({namespace=\"aprs\"}, container)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "container" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "APRS.me \u2014 Logs", + "uid": "logs-aprs", + "schemaVersion": 38, + "version": 1, + "refresh": "30s", + "panels": [ + { + "id": 1, + "type": "stat", + "title": "Log lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"aprs\", pod=~\"$pod\", container=~\"$container\"}[$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 2, + "type": "stat", + "title": "Error lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"aprs\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 3, + "type": "stat", + "title": "Distinct pods", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "count(count by (pod) (count_over_time({namespace=\"aprs\"}[$__range])))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 4, + "type": "timeseries", + "title": "Log rate by pod (lines/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"aprs\", pod=~\"$pod\", container=~\"$container\"}[$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 5, + "type": "timeseries", + "title": "Error rate by pod (matches/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10 + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"aprs\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 6, + "type": "logs", + "title": "Errors", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 12, + "w": 24, + "x": 0, + "y": 13 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"aprs\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\"", + "refId": "A", + "maxLines": 1000 + } + ] + }, + { + "id": 7, + "type": "logs", + "title": "All logs", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 16, + "w": 24, + "x": 0, + "y": 25 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"aprs\", pod=~\"$pod\", container=~\"$container\"}", + "refId": "A", + "maxLines": 1000 + } + ] + } + ] +} \ No newline at end of file diff --git a/ansible/roles/grafana/files/dashboards/logs-argocd.json b/ansible/roles/grafana/files/dashboards/logs-argocd.json new file mode 100644 index 0000000..61bf675 --- /dev/null +++ b/ansible/roles/grafana/files/dashboards/logs-argocd.json @@ -0,0 +1,437 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Pod logs for the ArgoCD app in the home-cluster, sourced from Loki.", + "editable": true, + "graphTooltip": 0, + "tags": [ + "logs", + "loki", + "argocd" + ], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "Loki", + "value": "Loki" + }, + "hide": 0, + "includeAll": false, + "label": "Datasource", + "multi": false, + "name": "datasource", + "options": [], + "query": "loki", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"argocd\"}, pod)", + "hide": 0, + "includeAll": true, + "label": "Pod", + "multi": true, + "name": "pod", + "query": { + "query": "label_values({namespace=\"argocd\"}, pod)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "pod" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"argocd\"}, container)", + "hide": 0, + "includeAll": true, + "label": "Container", + "multi": true, + "name": "container", + "query": { + "query": "label_values({namespace=\"argocd\"}, container)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "container" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "ArgoCD \u2014 Logs", + "uid": "logs-argocd", + "schemaVersion": 38, + "version": 1, + "refresh": "30s", + "panels": [ + { + "id": 1, + "type": "stat", + "title": "Log lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"argocd\", pod=~\"$pod\", container=~\"$container\"}[$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 2, + "type": "stat", + "title": "Error lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"argocd\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 3, + "type": "stat", + "title": "Distinct pods", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "count(count by (pod) (count_over_time({namespace=\"argocd\"}[$__range])))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 4, + "type": "timeseries", + "title": "Log rate by pod (lines/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"argocd\", pod=~\"$pod\", container=~\"$container\"}[$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 5, + "type": "timeseries", + "title": "Error rate by pod (matches/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10 + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"argocd\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 6, + "type": "logs", + "title": "Errors", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 12, + "w": 24, + "x": 0, + "y": 13 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"argocd\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\"", + "refId": "A", + "maxLines": 1000 + } + ] + }, + { + "id": 7, + "type": "logs", + "title": "All logs", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 16, + "w": 24, + "x": 0, + "y": 25 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"argocd\", pod=~\"$pod\", container=~\"$container\"}", + "refId": "A", + "maxLines": 1000 + } + ] + } + ] +} \ No newline at end of file diff --git a/ansible/roles/grafana/files/dashboards/logs-gridmap.json b/ansible/roles/grafana/files/dashboards/logs-gridmap.json new file mode 100644 index 0000000..a17d133 --- /dev/null +++ b/ansible/roles/grafana/files/dashboards/logs-gridmap.json @@ -0,0 +1,437 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Pod logs for the Gridmap app in the home-cluster, sourced from Loki.", + "editable": true, + "graphTooltip": 0, + "tags": [ + "logs", + "loki", + "gridmap" + ], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "Loki", + "value": "Loki" + }, + "hide": 0, + "includeAll": false, + "label": "Datasource", + "multi": false, + "name": "datasource", + "options": [], + "query": "loki", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"gridmap\"}, pod)", + "hide": 0, + "includeAll": true, + "label": "Pod", + "multi": true, + "name": "pod", + "query": { + "query": "label_values({namespace=\"gridmap\"}, pod)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "pod" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"gridmap\"}, container)", + "hide": 0, + "includeAll": true, + "label": "Container", + "multi": true, + "name": "container", + "query": { + "query": "label_values({namespace=\"gridmap\"}, container)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "container" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Gridmap \u2014 Logs", + "uid": "logs-gridmap", + "schemaVersion": 38, + "version": 1, + "refresh": "30s", + "panels": [ + { + "id": 1, + "type": "stat", + "title": "Log lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"gridmap\", pod=~\"$pod\", container=~\"$container\"}[$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 2, + "type": "stat", + "title": "Error lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"gridmap\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 3, + "type": "stat", + "title": "Distinct pods", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "count(count by (pod) (count_over_time({namespace=\"gridmap\"}[$__range])))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 4, + "type": "timeseries", + "title": "Log rate by pod (lines/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"gridmap\", pod=~\"$pod\", container=~\"$container\"}[$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 5, + "type": "timeseries", + "title": "Error rate by pod (matches/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10 + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"gridmap\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 6, + "type": "logs", + "title": "Errors", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 12, + "w": 24, + "x": 0, + "y": 13 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"gridmap\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\"", + "refId": "A", + "maxLines": 1000 + } + ] + }, + { + "id": 7, + "type": "logs", + "title": "All logs", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 16, + "w": 24, + "x": 0, + "y": 25 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"gridmap\", pod=~\"$pod\", container=~\"$container\"}", + "refId": "A", + "maxLines": 1000 + } + ] + } + ] +} \ No newline at end of file diff --git a/ansible/roles/grafana/files/dashboards/logs-prop.json b/ansible/roles/grafana/files/dashboards/logs-prop.json new file mode 100644 index 0000000..6764f2d --- /dev/null +++ b/ansible/roles/grafana/files/dashboards/logs-prop.json @@ -0,0 +1,437 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Pod logs for the Prop app in the home-cluster, sourced from Loki.", + "editable": true, + "graphTooltip": 0, + "tags": [ + "logs", + "loki", + "prop" + ], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "Loki", + "value": "Loki" + }, + "hide": 0, + "includeAll": false, + "label": "Datasource", + "multi": false, + "name": "datasource", + "options": [], + "query": "loki", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"prop\"}, pod)", + "hide": 0, + "includeAll": true, + "label": "Pod", + "multi": true, + "name": "pod", + "query": { + "query": "label_values({namespace=\"prop\"}, pod)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "pod" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"prop\"}, container)", + "hide": 0, + "includeAll": true, + "label": "Container", + "multi": true, + "name": "container", + "query": { + "query": "label_values({namespace=\"prop\"}, container)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "container" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Prop \u2014 Logs", + "uid": "logs-prop", + "schemaVersion": 38, + "version": 1, + "refresh": "30s", + "panels": [ + { + "id": 1, + "type": "stat", + "title": "Log lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"prop\", pod=~\"$pod\", container=~\"$container\"}[$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 2, + "type": "stat", + "title": "Error lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"prop\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 3, + "type": "stat", + "title": "Distinct pods", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "count(count by (pod) (count_over_time({namespace=\"prop\"}[$__range])))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 4, + "type": "timeseries", + "title": "Log rate by pod (lines/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"prop\", pod=~\"$pod\", container=~\"$container\"}[$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 5, + "type": "timeseries", + "title": "Error rate by pod (matches/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10 + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"prop\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 6, + "type": "logs", + "title": "Errors", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 12, + "w": 24, + "x": 0, + "y": 13 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"prop\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\"", + "refId": "A", + "maxLines": 1000 + } + ] + }, + { + "id": 7, + "type": "logs", + "title": "All logs", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 16, + "w": 24, + "x": 0, + "y": 25 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"prop\", pod=~\"$pod\", container=~\"$container\"}", + "refId": "A", + "maxLines": 1000 + } + ] + } + ] +} \ No newline at end of file diff --git a/ansible/roles/grafana/files/dashboards/logs-towerops.json b/ansible/roles/grafana/files/dashboards/logs-towerops.json new file mode 100644 index 0000000..24d2aa8 --- /dev/null +++ b/ansible/roles/grafana/files/dashboards/logs-towerops.json @@ -0,0 +1,437 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Pod logs for the TowerOps app in the home-cluster, sourced from Loki.", + "editable": true, + "graphTooltip": 0, + "tags": [ + "logs", + "loki", + "towerops" + ], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "Loki", + "value": "Loki" + }, + "hide": 0, + "includeAll": false, + "label": "Datasource", + "multi": false, + "name": "datasource", + "options": [], + "query": "loki", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"towerops\"}, pod)", + "hide": 0, + "includeAll": true, + "label": "Pod", + "multi": true, + "name": "pod", + "query": { + "query": "label_values({namespace=\"towerops\"}, pod)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "pod" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + }, + { + "datasource": "$datasource", + "definition": "label_values({namespace=\"towerops\"}, container)", + "hide": 0, + "includeAll": true, + "label": "Container", + "multi": true, + "name": "container", + "query": { + "query": "label_values({namespace=\"towerops\"}, container)", + "refId": "LokiVariableQueryEditor-VariableQuery", + "type": 1, + "stream": "", + "label": "container" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query", + "allValue": ".+" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "TowerOps \u2014 Logs", + "uid": "logs-towerops", + "schemaVersion": 38, + "version": 1, + "refresh": "30s", + "panels": [ + { + "id": 1, + "type": "stat", + "title": "Log lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"towerops\", pod=~\"$pod\", container=~\"$container\"}[$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 2, + "type": "stat", + "title": "Error lines (window)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "sum(count_over_time({namespace=\"towerops\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__range]))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 3, + "type": "stat", + "title": "Distinct pods", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 0 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "textMode": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "targets": [ + { + "expr": "count(count by (pod) (count_over_time({namespace=\"towerops\"}[$__range])))", + "queryType": "instant", + "refId": "A" + } + ] + }, + { + "id": 4, + "type": "timeseries", + "title": "Log rate by pod (lines/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"towerops\", pod=~\"$pod\", container=~\"$container\"}[$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 5, + "type": "timeseries", + "title": "Error rate by pod (matches/s)", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 4 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 1, + "fillOpacity": 10 + }, + "color": { + "mode": "palette-classic" + }, + "unit": "logs/s" + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "displayMode": "table", + "placement": "bottom", + "calcs": [ + "sum", + "max" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "expr": "sum by (pod) (rate({namespace=\"towerops\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\" [$__interval]))", + "legendFormat": "{{pod}}", + "refId": "A" + } + ] + }, + { + "id": 6, + "type": "logs", + "title": "Errors", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 12, + "w": 24, + "x": 0, + "y": 13 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"towerops\", pod=~\"$pod\", container=~\"$container\"} |~ \"(?i)\\\\b(error|err|panic|fatal|exception|traceback)\\\\b\"", + "refId": "A", + "maxLines": 1000 + } + ] + }, + { + "id": 7, + "type": "logs", + "title": "All logs", + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "gridPos": { + "h": 16, + "w": 24, + "x": 0, + "y": 25 + }, + "options": { + "showTime": true, + "showLabels": false, + "showCommonLabels": false, + "wrapLogMessage": true, + "prettifyLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "expr": "{namespace=\"towerops\", pod=~\"$pod\", container=~\"$container\"}", + "refId": "A", + "maxLines": 1000 + } + ] + } + ] +} \ No newline at end of file