apiVersion: v1 kind: ConfigMap metadata: labels: grafana_dashboard: "1" name: grafana-dashboard-logs namespace: monitoring data: logs.json: | { "uid": "logs", "title": "Logs", "editable": true, "schemaVersion": 41, "refresh": "", "time": { "from": "now-1h", "to": "now" }, "timezone": "browser", "tags": [], "templating": { "list": [ { "name": "namespace", "label": "Namespace", "type": "query", "datasource": { "type": "loki", "uid": "loki" }, "query": { "type": 1, "label": "namespace", "refId": "ns" }, "definition": "label_values(namespace)", "multi": true, "includeAll": true, "allValue": ".+", "current": { "text": "All", "value": "$__all" }, "refresh": 2, "sort": 1 }, { "name": "app", "label": "App", "type": "query", "datasource": { "type": "loki", "uid": "loki" }, "query": { "type": 1, "label": "app", "stream": "{namespace=~\"$namespace\"}", "refId": "app" }, "definition": "label_values({namespace=~\"$namespace\"}, app)", "multi": true, "includeAll": true, "allValue": ".*", "current": { "text": "All", "value": "$__all" }, "refresh": 2, "sort": 1 }, { "name": "search", "label": "Search", "type": "textbox", "query": "", "current": { "text": "", "value": "" } } ] }, "panels": [ { "type": "timeseries", "title": "Log volume", "id": 1, "datasource": { "type": "loki", "uid": "loki" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 0 }, "targets": [ { "refId": "A", "datasource": { "type": "loki", "uid": "loki" }, "expr": "sum by (app) (count_over_time({namespace=~\"$namespace\", app=~\"$app\"} |= \"$search\" [$__auto]))", "legendFormat": "{{app}}", "queryType": "range" } ], "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "fillOpacity": 80, "showPoints": "never", "stacking": { "mode": "normal" }, "drawStyle": "bars" } }, "overrides": [] } }, { "type": "timeseries", "title": "Error lines", "id": 2, "datasource": { "type": "loki", "uid": "loki" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 0 }, "targets": [ { "refId": "A", "datasource": { "type": "loki", "uid": "loki" }, "expr": "sum by (app) (count_over_time({namespace=~\"$namespace\", app=~\"$app\"} |= \"$search\" |~ \"(?i)(error|exception|panic|fatal)\" [$__auto]))", "legendFormat": "{{app}}", "queryType": "range" } ], "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "fillOpacity": 80, "showPoints": "never", "stacking": { "mode": "normal" }, "drawStyle": "bars" } }, "overrides": [] } }, { "type": "logs", "title": "Logs", "id": 3, "datasource": { "type": "loki", "uid": "loki" }, "gridPos": { "h": 18, "w": 24, "x": 0, "y": 7 }, "targets": [ { "refId": "A", "datasource": { "type": "loki", "uid": "loki" }, "expr": "{namespace=~\"$namespace\", app=~\"$app\"} |= \"$search\"", "queryType": "range" } ], "options": { "showTime": true, "wrapLogMessage": true, "sortOrder": "Descending", "enableLogDetails": true, "dedupStrategy": "none", "showLabels": false } }, { "type": "row", "title": "HTTP requests (Traefik)", "id": 4, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 25 }, "panels": [] }, { "type": "timeseries", "title": "Requests by host", "id": 5, "datasource": { "type": "loki", "uid": "loki" }, "gridPos": { "h": 8, "w": 12, "x": 0, "y": 26 }, "targets": [ { "refId": "A", "datasource": { "type": "loki", "uid": "loki" }, "expr": "sum by (RequestHost) (count_over_time({namespace=\"traefik\"} | json | __error__=\"\" | RequestHost != \"\" [$__auto]))", "legendFormat": "{{RequestHost}}", "queryType": "range" } ], "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "fillOpacity": 80, "showPoints": "never", "stacking": { "mode": "normal" }, "drawStyle": "bars" } }, "overrides": [] } }, { "type": "timeseries", "title": "Responses by status", "id": 6, "datasource": { "type": "loki", "uid": "loki" }, "gridPos": { "h": 8, "w": 12, "x": 12, "y": 26 }, "targets": [ { "refId": "A", "datasource": { "type": "loki", "uid": "loki" }, "expr": "sum by (DownstreamStatus) (count_over_time({namespace=\"traefik\"} | json | __error__=\"\" | RequestHost != \"\" [$__auto]))", "legendFormat": "{{DownstreamStatus}}", "queryType": "range" } ], "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "fillOpacity": 80, "showPoints": "never", "stacking": { "mode": "normal" }, "drawStyle": "bars" } }, "overrides": [] } }, { "type": "timeseries", "title": "p95 response time by host", "id": 7, "datasource": { "type": "loki", "uid": "loki" }, "gridPos": { "h": 8, "w": 24, "x": 0, "y": 34 }, "targets": [ { "refId": "A", "datasource": { "type": "loki", "uid": "loki" }, "expr": "quantile_over_time(0.95, {namespace=\"traefik\"} | json | __error__=\"\" | RequestHost != \"\" | unwrap Duration [$__auto]) by (RequestHost)", "legendFormat": "{{RequestHost}}", "queryType": "range" } ], "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "tooltip": { "mode": "multi", "sort": "desc" } }, "fieldConfig": { "defaults": { "unit": "ns", "custom": { "fillOpacity": 10, "showPoints": "never" } }, "overrides": [] } }, { "type": "logs", "title": "Access log", "id": 8, "datasource": { "type": "loki", "uid": "loki" }, "gridPos": { "h": 12, "w": 24, "x": 0, "y": 42 }, "targets": [ { "refId": "A", "datasource": { "type": "loki", "uid": "loki" }, "queryType": "range", "expr": "{namespace=\"traefik\"} | json | __error__=\"\" | RequestHost != \"\" | line_format \"{{.DownstreamStatus}} {{.RequestMethod}} {{.RequestHost}}{{.RequestPath}} {{div .Duration 1000000}}ms {{.ClientHost}}\"" } ], "options": { "showTime": true, "wrapLogMessage": false, "sortOrder": "Descending", "enableLogDetails": true, "dedupStrategy": "none", "showLabels": false } } ], "annotations": { "list": [] } }