Files
homelab/dashboards/traefik-dashboards/traefik-access-logs-dashboard.json
2026-09-01 14:01:26 +03:30

263 lines
11 KiB
JSON

{
"annotations": { "list": [] },
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 1,
"id": null,
"links": [],
"liveNow": true,
"panels": [
{
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 },
"id": 100,
"panels": [],
"title": "Overview",
"type": "row"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"fieldConfig": {
"defaults": { "color": { "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }, "unit": "reqps" },
"overrides": []
},
"gridPos": { "h": 4, "w": 6, "x": 0, "y": 1 },
"id": 1,
"options": { "colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false }, "textMode": "auto" },
"targets": [
{
"datasource": { "type": "loki", "uid": "${loki}" },
"expr": "sum(rate({container_name=\"traefik\"} | json | __error__=\"\" [5m]))",
"legendFormat": "requests/s",
"refId": "A"
}
],
"title": "Request Rate",
"type": "stat"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"fieldConfig": {
"defaults": { "color": { "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }, { "color": "red", "value": 0.01 }] }, "unit": "percentunit" },
"overrides": []
},
"gridPos": { "h": 4, "w": 6, "x": 6, "y": 1 },
"id": 2,
"options": { "colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false }, "textMode": "auto" },
"targets": [
{
"datasource": { "type": "loki", "uid": "${loki}" },
"expr": "sum(rate({container_name=\"traefik\"} | json | __error__=\"\" | DownstreamStatus >= 500 [5m])) / sum(rate({container_name=\"traefik\"} | json | __error__=\"\" [5m]))",
"legendFormat": "5xx rate",
"refId": "A"
}
],
"title": "5xx Error Rate",
"type": "stat"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"fieldConfig": {
"defaults": { "color": { "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }, { "color": "orange", "value": 0.02 }] }, "unit": "percentunit" },
"overrides": []
},
"gridPos": { "h": 4, "w": 6, "x": 12, "y": 1 },
"id": 3,
"options": { "colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false }, "textMode": "auto" },
"targets": [
{
"datasource": { "type": "loki", "uid": "${loki}" },
"expr": "sum(rate({container_name=\"traefik\"} | json | __error__=\"\" | DownstreamStatus >= 400 | DownstreamStatus < 500 [5m])) / sum(rate({container_name=\"traefik\"} | json | __error__=\"\" [5m]))",
"legendFormat": "4xx rate",
"refId": "A"
}
],
"title": "4xx Error Rate",
"type": "stat"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"fieldConfig": {
"defaults": { "color": { "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }, { "color": "yellow", "value": 300 }, { "color": "red", "value": 1000 }] }, "unit": "ms" },
"overrides": []
},
"gridPos": { "h": 4, "w": 6, "x": 18, "y": 1 },
"id": 4,
"options": { "colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": false }, "textMode": "auto" },
"targets": [
{
"datasource": { "type": "loki", "uid": "${loki}" },
"expr": "avg(avg_over_time({container_name=\"traefik\"} | json | __error__=\"\" | unwrap Duration [5m])) / 1e6",
"legendFormat": "avg duration",
"refId": "A"
}
],
"title": "Avg Response Time",
"type": "stat"
},
{
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 5 },
"id": 101,
"panels": [],
"title": "Traffic Breakdown",
"type": "row"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"description": "Request volume by status code family over time.",
"fieldConfig": {
"defaults": { "color": { "mode": "palette-classic" }, "custom": { "drawStyle": "line", "fillOpacity": 25, "lineWidth": 1, "pointSize": 5, "showPoints": "never", "spanNulls": true, "stacking": { "group": "A", "mode": "normal" } }, "mappings": [], "unit": "reqps" },
"overrides": [
{ "matcher": { "id": "byName", "options": "2xx" }, "properties": [{ "id": "color", "value": { "fixedColor": "green", "mode": "fixed" } }] },
{ "matcher": { "id": "byName", "options": "3xx" }, "properties": [{ "id": "color", "value": { "fixedColor": "blue", "mode": "fixed" } }] },
{ "matcher": { "id": "byName", "options": "4xx" }, "properties": [{ "id": "color", "value": { "fixedColor": "orange", "mode": "fixed" } }] },
{ "matcher": { "id": "byName", "options": "5xx" }, "properties": [{ "id": "color", "value": { "fixedColor": "red", "mode": "fixed" } }] }
]
},
"gridPos": { "h": 9, "w": 12, "x": 0, "y": 6 },
"id": 5,
"options": { "legend": { "calcs": ["sum"], "displayMode": "table", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } },
"targets": [
{ "datasource": { "type": "loki", "uid": "${loki}" }, "expr": "sum(rate({container_name=\"traefik\"} | json | __error__=\"\" | DownstreamStatus >= 200 | DownstreamStatus < 300 [5m]))", "legendFormat": "2xx", "refId": "A" },
{ "datasource": { "type": "loki", "uid": "${loki}" }, "expr": "sum(rate({container_name=\"traefik\"} | json | __error__=\"\" | DownstreamStatus >= 300 | DownstreamStatus < 400 [5m]))", "legendFormat": "3xx", "refId": "B" },
{ "datasource": { "type": "loki", "uid": "${loki}" }, "expr": "sum(rate({container_name=\"traefik\"} | json | __error__=\"\" | DownstreamStatus >= 400 | DownstreamStatus < 500 [5m]))", "legendFormat": "4xx", "refId": "C" },
{ "datasource": { "type": "loki", "uid": "${loki}" }, "expr": "sum(rate({container_name=\"traefik\"} | json | __error__=\"\" | DownstreamStatus >= 500 [5m]))", "legendFormat": "5xx", "refId": "D" }
],
"title": "Response Codes Over Time",
"type": "timeseries"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"description": "Which site (router) is generating the most log volume right now.",
"fieldConfig": {
"defaults": { "color": { "mode": "palette-classic" }, "custom": { "drawStyle": "line", "fillOpacity": 10, "lineWidth": 2, "pointSize": 5, "showPoints": "never", "spanNulls": true }, "mappings": [], "unit": "reqps" },
"overrides": []
},
"gridPos": { "h": 9, "w": 12, "x": 12, "y": 6 },
"id": 6,
"options": { "legend": { "calcs": ["sum"], "displayMode": "table", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } },
"targets": [
{
"datasource": { "type": "loki", "uid": "${loki}" },
"expr": "sum by (RouterName) (rate({container_name=\"traefik\"} | json | __error__=\"\" [5m]))",
"legendFormat": "{{RouterName}}",
"refId": "A"
}
],
"title": "Requests by Site (Router)",
"transformations": [{ "id": "renameByRegex", "options": { "regex": "(.*)@docker", "renamePattern": "$1" } }],
"type": "timeseries"
},
{
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 15 },
"id": 102,
"panels": [],
"title": "Live Logs",
"type": "row"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"description": "Raw Traefik access log stream, most recent first.",
"fieldConfig": { "defaults": {}, "overrides": [] },
"gridPos": { "h": 10, "w": 24, "x": 0, "y": 16 },
"id": 7,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": true,
"showCommonLabels": false,
"showLabels": false,
"showTime": true,
"sortOrder": "Descending",
"wrapLogMessage": true
},
"targets": [
{
"datasource": { "type": "loki", "uid": "${loki}" },
"expr": "{container_name=\"traefik\"}",
"refId": "A"
}
],
"title": "All Access Logs",
"type": "logs"
},
{
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 26 },
"id": 103,
"panels": [],
"title": "Problems",
"type": "row"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"description": "Only requests that returned 4xx or 5xx.",
"fieldConfig": { "defaults": {}, "overrides": [] },
"gridPos": { "h": 9, "w": 12, "x": 0, "y": 27 },
"id": 8,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": true,
"showCommonLabels": false,
"showLabels": false,
"showTime": true,
"sortOrder": "Descending",
"wrapLogMessage": true
},
"targets": [
{
"datasource": { "type": "loki", "uid": "${loki}" },
"expr": "{container_name=\"traefik\"} | json | __error__=\"\" | DownstreamStatus >= 400",
"refId": "A"
}
],
"title": "Error Requests (4xx/5xx)",
"type": "logs"
},
{
"datasource": { "type": "loki", "uid": "${loki}" },
"description": "Requests that took longer than 500ms to respond.",
"fieldConfig": { "defaults": {}, "overrides": [] },
"gridPos": { "h": 9, "w": 12, "x": 12, "y": 27 },
"id": 9,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": true,
"showCommonLabels": false,
"showLabels": false,
"showTime": true,
"sortOrder": "Descending",
"wrapLogMessage": true
},
"targets": [
{
"datasource": { "type": "loki", "uid": "${loki}" },
"expr": "{container_name=\"traefik\"} | json | __error__=\"\" | Duration > 500000000",
"refId": "A"
}
],
"title": "Slow Requests (>500ms)",
"type": "logs"
}
],
"refresh": "10s",
"schemaVersion": 38,
"tags": ["traefik", "logs", "loki", "homelab"],
"templating": {
"list": [
{ "current": {}, "hide": 0, "label": "Loki", "name": "loki", "query": "loki", "refresh": 1, "regex": "", "type": "datasource" }
]
},
"time": { "from": "now-1h", "to": "now" },
"timepicker": {},
"timezone": "",
"title": "Traefik - Access Logs",
"uid": "traefik-access-logs",
"version": 1,
"weekStart": ""
}