From cd8534e10ff1fed10e349a5a5ebcad5ba803b721 Mon Sep 17 00:00:00 2001 From: ahinvinith Date: Mon, 29 Jan 2024 21:45:31 +0530 Subject: [PATCH] Added dashboard for logs --- charts/monitoring/Chart.yaml | 2 +- .../templates/node-logs-dashboard.yaml | 415 +++++++++++ .../templates/pod-logs-dashboard.yaml | 662 ++++++++++++++++++ 3 files changed, 1078 insertions(+), 1 deletion(-) create mode 100644 charts/monitoring/templates/node-logs-dashboard.yaml create mode 100644 charts/monitoring/templates/pod-logs-dashboard.yaml diff --git a/charts/monitoring/Chart.yaml b/charts/monitoring/Chart.yaml index 187dc84..e008c99 100644 --- a/charts/monitoring/Chart.yaml +++ b/charts/monitoring/Chart.yaml @@ -3,7 +3,7 @@ appVersion: 1.16.0 description: A Helm chart for Monitoring name: monitoring type: application -version: 0.1.11 +version: 0.1.12 dependencies: - name: prometheus-msteams condition: prometheus-msteams.enabled diff --git a/charts/monitoring/templates/node-logs-dashboard.yaml b/charts/monitoring/templates/node-logs-dashboard.yaml new file mode 100644 index 0000000..5c92991 --- /dev/null +++ b/charts/monitoring/templates/node-logs-dashboard.yaml @@ -0,0 +1,415 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "monitoring.fullname" . }}-node-logs + annotations: + meta.helm.sh/release-namespace: {{ .Release.Namespace }} + grafana_folder: "Logs" + labels: + grafana_dashboard: "1" +data: + cluster.json: |- + { + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 108, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 11, + "x": 0, + "y": 0 + }, + "id": 3, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "code", + "expr": "sum(count_over_time({cluster_name=\"$cluster_name\", node_name=\"$node\"} [$__interval]))", + "queryType": "range", + "refId": "A" + } + ], + "title": "Total Log Entries Over Time for Node: $node", + "type": "stat" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 13, + "x": 11, + "y": 0 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "builder", + "expr": "topk(5, sum by(job) (count_over_time({cluster_name=\"$cluster_name\", node_name=\"$node\"} |= `$filter` [1h])))", + "queryType": "range", + "refId": "A" + } + ], + "title": "Top 5 Jobs with the Most $filter", + "type": "timeseries" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "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": 7, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "builder", + "expr": "count_over_time({cluster_name=\"$cluster_name\", node_name=\"$node\"} |= `$filter` [$__range])", + "key": "Q-a8862167-ca91-49e3-9b89-52a7b6164229-0", + "legendFormat": "{{node_name}}", + "queryType": "range", + "refId": "A" + } + ], + "title": "Node $filter Count Over Time", + "type": "timeseries" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "gridPos": { + "h": 15, + "w": 24, + "x": 0, + "y": 14 + }, + "id": 2, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "builder", + "expr": "{cluster_name=\"$cluster_name\", node_name=\"$node\"} |= `$filter`", + "key": "Q-a8862167-ca91-49e3-9b89-52a7b6164229-0", + "queryType": "range", + "refId": "A" + } + ], + "title": "Node logs", + "type": "logs" + } + ], + "refresh": "", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "dev-alpha", + "value": "dev-alpha" + }, + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "definition": "", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "cluster_name", + "options": [], + "query": { + "label": "cluster_name", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "ip-10-0-2-134.ec2.internal", + "value": "ip-10-0-2-134.ec2.internal" + }, + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "definition": "", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "node", + "options": [], + "query": { + "label": "node_name", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "{cluster_name=\"$cluster_name\"}", + "type": 1 + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "", + "value": "" + }, + "hide": 0, + "name": "filter", + "options": [ + { + "selected": true, + "text": "", + "value": "" + } + ], + "query": "", + "skipUrlSync": false, + "type": "textbox" + } + ] + }, + "time": { + "from": "now-5m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Node logs", + "uid": "b6beb5cc-2215-44f4-8097-e8ab0029ff60", + "version": 3, + "weekStart": "" + } \ No newline at end of file diff --git a/charts/monitoring/templates/pod-logs-dashboard.yaml b/charts/monitoring/templates/pod-logs-dashboard.yaml new file mode 100644 index 0000000..d7b4979 --- /dev/null +++ b/charts/monitoring/templates/pod-logs-dashboard.yaml @@ -0,0 +1,662 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "monitoring.fullname" . }}-pod-logs + annotations: + meta.helm.sh/release-namespace: {{ .Release.Namespace }} + grafana_folder: "Logs" + labels: + grafana_dashboard: "1" +data: + cluster.json: |- + { + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 109, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 70 + }, + { + "color": "red", + "value": 85 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 0 + }, + "id": 6, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "code", + "expr": "sum(count_over_time({pod=\"$pod\", cluster_name=\"$cluster_name\"} |= `$filter` [$__interval])) by (stream)", + "hide": false, + "queryType": "range", + "refId": "A" + } + ], + "title": "Total count of stderr / stdout ", + "type": "gauge" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 70 + }, + { + "color": "red", + "value": 85 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 7, + "x": 8, + "y": 0 + }, + "id": 7, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "code", + "expr": "sum(count_over_time(({ pod=~\"$pod\",cluster_name=\"$cluster_name\", stream=~\"stderr\"} |~ \"(?i)$filter\")[$__interval])) * 100 / sum(count_over_time(({pod=~\"$pod\",cluster_name=\"$cluster_name\", stream=~\"stderr\"})[$__interval]))", + "queryType": "range", + "refId": "A" + } + ], + "title": "\"$filter\" Percentage for specified time", + "type": "gauge" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 5, + "x": 15, + "y": 0 + }, + "id": 8, + "options": { + "colorMode": "background_solid", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.3", + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "builder", + "expr": "sum(count_over_time({pod=\"$pod\", cluster_name=\"$cluster_name\", stream=\"stderr\"} |= `$filter` | logfmt [$__interval]))", + "queryType": "range", + "refId": "A" + } + ], + "title": "Total Count of logs", + "type": "stat" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": 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": 11, + "x": 0, + "y": 5 + }, + "id": 4, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "code", + "expr": "sum(count_over_time({pod=\"$pod\", cluster_name=\"$cluster_name\", stream=\"stderr\"} |~ \"(?i)$filter\"[$__interval])) by (pod)", + "queryType": "range", + "refId": "A" + } + ], + "title": "Matched word: \"$filter\" historical", + "type": "timeseries" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": 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": 11, + "y": 5 + }, + "id": 5, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "builder", + "expr": "sum(rate(({pod=\"$pod\", cluster_name=\"$cluster_name\", stream=~\"stderr\"} |~ \"(?i)$filter\")[30s])) by (pod)", + "queryType": "range", + "refId": "A" + } + ], + "title": "\"$filter\" Rate per Pod", + "type": "timeseries" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 20, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 3, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 13 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "code", + "expr": "sum(rate({pod=\"$pod\", cluster_name=\"$cluster_name\"} |= `$filter` [$__interval])) by (stream)", + "queryType": "range", + "refId": "A" + } + ], + "title": "Count of stderr / stdout historical", + "type": "timeseries" + }, + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 21 + }, + "id": 2, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "editorMode": "builder", + "expr": "{pod=\"$pod\", cluster_name=\"$cluster_name\"} |= `$filter` | logfmt", + "queryType": "range", + "refId": "A" + } + ], + "title": "Raw logs", + "type": "logs" + } + ], + "refresh": "", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "capten-controlplane", + "value": "capten-controlplane" + }, + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "definition": "", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "cluster_name", + "options": [], + "query": { + "label": "cluster_name", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "kube-system", + "value": "kube-system" + }, + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "definition": "", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "namespace", + "options": [], + "query": { + "label": "namespace", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "{cluster_name=\"$cluster_name\"}", + "type": 1 + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "canal-h75vb", + "value": "canal-h75vb" + }, + "datasource": { + "type": "Loki", + "uid": "Loki" + }, + "definition": "", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "pod", + "options": [], + "query": { + "label": "pod", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "{cluster_name=\"$cluster_name\", namespace=\"$namespace\"}", + "type": 1 + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "", + "value": "" + }, + "hide": 0, + "name": "filter", + "options": [ + { + "selected": true, + "text": "", + "value": "" + } + ], + "query": "", + "skipUrlSync": false, + "type": "textbox" + } + ] + }, + "time": { + "from": "now-5m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Pod logs", + "uid": "d3983a93-548c-4fe7-913b-ea361930ee7bb", + "version": 2, + "weekStart": "" + } \ No newline at end of file