Files
gh-jeremylongshore-claude-c…/skills/log-aggregation-setup/assets/dashboard_loki.json
2025-11-30 08:19:52 +08:00

288 lines
6.8 KiB
JSON

{
"_comment": "Grafana dashboard for Loki",
"dashboard": {
"annotations": {
"list": []
},
"description": "Example Grafana dashboard for Loki log aggregation.",
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"links": [],
"panels": [
{
"_comment": "Panel: Logs overview",
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"display": "auto",
"filterable": true
},
"mappings": [],
"min": null,
"max": null,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"dedupStrategy": "none",
"enableExemplar": true,
"prettifyJson": true,
"showCommonContext": true,
"showTime": true,
"sortOrder": "Descending",
"wrapLines": true
},
"pluginVersion": "7.5.7",
"targets": [
{
"datasource": "${DS_LOKI}",
"editorMode": "code",
"expr": "{job=\"my-app\"} |= \"error\"",
"instant": false,
"queryType": "range",
"refId": "A"
}
],
"title": "Error Logs",
"type": "logs"
},
{
"_comment": "Panel: Log volume over time",
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"fillOpacity": 20,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"showPoints": "auto",
"spanNulls": false,
"stacking": "normal",
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": null,
"max": null,
"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": 3,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "7.5.7",
"targets": [
{
"datasource": "${DS_LOKI}",
"editorMode": "code",
"expr": "rate({job=\"my-app\"} |= `error` [1m])",
"instant": false,
"legendFormat": "{{job}}",
"queryType": "range",
"refId": "A"
}
],
"title": "Error Log Volume",
"type": "timeseries"
},
{
"_comment": "Panel: HTTP Request Latency",
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"fillOpacity": 20,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"showPoints": "auto",
"spanNulls": false,
"stacking": "normal",
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": null,
"max": null,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ms"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 8
},
"id": 4,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "7.5.7",
"targets": [
{
"datasource": "${DS_LOKI}",
"editorMode": "code",
"expr": "histogram_quantile(0.99, sum(rate({job=\"my-app\", endpoint=\"/api/users\"} | json | unwrap duration [1m])) by (le))",
"instant": false,
"legendFormat": "99th percentile",
"queryType": "range",
"refId": "A"
}
],
"title": "HTTP Request Latency (99th percentile)",
"type": "timeseries"
}
],
"refresh": "1m",
"schemaVersion": 30,
"style": "dark",
"tags": [
"loki",
"logs",
"example"
],
"templating": {
"list": [
{
"_comment": "Loki datasource variable",
"current": {
"text": "Loki",
"value": "Loki"
},
"datasource": null,
"definition": "Loki",
"hide": 0,
"includeAll": false,
"label": "Loki Datasource",
"multi": false,
"name": "DS_LOKI",
"options": [],
"query": "Loki",
"refresh": 1,
"regex": "",
"sort": 0,
"tagValuesQuery": "",
"tagsQuery": "",
"type": "datasource",
"useTags": false
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "Loki Log Aggregation Dashboard",
"uid": "logi-aggregation-dashboard",
"version": 1
}
}