{ "dashboard": { "id": null, "title": "Loki 日志热点图 Demo", "tags": ["loki", "heatmap", "demo"], "style": "dark", "timezone": "browser", "panels": [ { "id": 1, "title": "日志级别热点图 (类似GitHub贡献图)", "type": "heatmap", "targets": [ { "datasource": { "type": "loki", "uid": "loki" }, "expr": "sum by (level) (rate({job=\"systemd-journal\"}[5m]))", "refId": "A", "legendFormat": "{{level}}" } ], "fieldConfig": { "defaults": { "custom": { "hideFrom": { "legend": false, "tooltip": false, "vis": false }, "scaleDistribution": { "type": "linear" } }, "color": { "mode": "palette-classic" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 1 }, { "color": "red", "value": 10 } ] } } }, "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 }, "options": { "calculate": false, "cellGap": 2, "cellValues": { "unit": "short" }, "color": { "exponent": 0.5, "fill": "dark-orange", "mode": "spectrum", "reverse": false, "scale": "exponential", "scheme": "Spectral", "steps": 64 }, "exemplars": { "color": "rgba(255,0,255,0.7)" }, "filterValues": { "le": 1e-9 }, "legend": { "show": true }, "rowsFrame": { "layout": "auto" }, "tooltip": { "show": true, "yHistogram": false }, "yAxis": { "axisPlacement": "left", "reverse": false, "unit": "short" } } }, { "id": 2, "title": "节点日志密度热点图", "type": "heatmap", "targets": [ { "datasource": { "type": "loki", "uid": "loki" }, "expr": "sum by (hostname) (rate({job=\"systemd-journal\"}[5m]))", "refId": "A", "legendFormat": "{{hostname}}" } ], "fieldConfig": { "defaults": { "custom": { "hideFrom": { "legend": false, "tooltip": false, "vis": false } }, "color": { "mode": "palette-classic" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 5 }, { "color": "red", "value": 20 } ] } } }, "gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 }, "options": { "calculate": false, "cellGap": 2, "cellValues": { "unit": "short" }, "color": { "exponent": 0.5, "fill": "dark-orange", "mode": "spectrum", "reverse": false, "scale": "exponential", "scheme": "Spectral", "steps": 64 }, "exemplars": { "color": "rgba(255,0,255,0.7)" }, "filterValues": { "le": 1e-9 }, "legend": { "show": true }, "rowsFrame": { "layout": "auto" }, "tooltip": { "show": true, "yHistogram": false }, "yAxis": { "axisPlacement": "left", "reverse": false, "unit": "short" } } }, { "id": 3, "title": "关键服务日志热点图 (Nomad/Consul/Traefik)", "type": "heatmap", "targets": [ { "datasource": { "type": "loki", "uid": "loki" }, "expr": "sum by (unit) (rate({job=\"systemd-journal\", unit=~\"nomad|consul|traefik\"}[5m]))", "refId": "A", "legendFormat": "{{unit}}" } ], "fieldConfig": { "defaults": { "custom": { "hideFrom": { "legend": false, "tooltip": false, "vis": false } }, "color": { "mode": "palette-classic" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 1 }, { "color": "red", "value": 5 } ] } } }, "gridPos": { "h": 8, "w": 24, "x": 0, "y": 8 }, "options": { "calculate": false, "cellGap": 2, "cellValues": { "unit": "short" }, "color": { "exponent": 0.5, "fill": "dark-orange", "mode": "spectrum", "reverse": false, "scale": "exponential", "scheme": "Spectral", "steps": 64 }, "exemplars": { "color": "rgba(255,0,255,0.7)" }, "filterValues": { "le": 1e-9 }, "legend": { "show": true }, "rowsFrame": { "layout": "auto" }, "tooltip": { "show": true, "yHistogram": false }, "yAxis": { "axisPlacement": "left", "reverse": false, "unit": "short" } } }, { "id": 4, "title": "ERROR/CRIT 级别日志热点图 (黑匣子重点)", "type": "heatmap", "targets": [ { "datasource": { "type": "loki", "uid": "loki" }, "expr": "sum by (hostname) (rate({job=\"systemd-journal\", level=~\"error|crit\"}[5m]))", "refId": "A", "legendFormat": "{{hostname}} - {{level}}" } ], "fieldConfig": { "defaults": { "custom": { "hideFrom": { "legend": false, "tooltip": false, "vis": false } }, "color": { "mode": "palette-classic" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "orange", "value": 0.1 }, { "color": "red", "value": 1 } ] } } }, "gridPos": { "h": 8, "w": 24, "x": 0, "y": 16 }, "options": { "calculate": false, "cellGap": 2, "cellValues": { "unit": "short" }, "color": { "exponent": 0.5, "fill": "dark-orange", "mode": "spectrum", "reverse": false, "scale": "exponential", "scheme": "Spectral", "steps": 64 }, "exemplars": { "color": "rgba(255,0,255,0.7)" }, "filterValues": { "le": 1e-9 }, "legend": { "show": true }, "rowsFrame": { "layout": "auto" }, "tooltip": { "show": true, "yHistogram": false }, "yAxis": { "axisPlacement": "left", "reverse": false, "unit": "short" } } } ], "time": { "from": "now-1h", "to": "now" }, "timepicker": {}, "templating": { "list": [] }, "annotations": { "list": [] }, "refresh": "30s", "schemaVersion": 27, "version": 1 } }