{ "dashboard": { "title": "Application Logs", "tags": [ "logs", "loki", "fetch_ml" ], "timezone": "browser", "editable": true, "graphTooltip": 1, "time": { "from": "now-1h", "to": "now" }, "timepicker": { "refresh_intervals": [ "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h" ], "time_options": [ "5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d" ] }, "panels": [ { "title": "Log Stream", "type": "logs", "gridPos": { "x": 0, "y": 0, "w": 24, "h": 12 }, "id": 1, "targets": [ { "expr": "{job=\"app_logs\"}", "refId": "A", "datasource": "Loki" } ], "options": { "showTime": true, "showLabels": true, "showCommonLabels": false, "wrapLogMessage": false, "prettifyLogMessage": false, "enableLogDetails": true, "dedupStrategy": "none", "sortOrder": "Descending" } }, { "title": "Log Level Distribution", "type": "bargauge", "gridPos": { "x": 0, "y": 12, "w": 8, "h": 8 }, "id": 2, "targets": [ { "expr": "sum by (level) (count_over_time({job=\"app_logs\"} | logfmt | level != \"\" [5m]))", "refId": "A", "datasource": "Loki", "legendFormat": "{{level}}" } ], "options": { "orientation": "horizontal", "displayMode": "gradient", "showUnfilled": true }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" } }, "overrides": [ { "matcher": { "id": "byName", "options": "INFO" }, "properties": [ { "id": "color", "value": { "mode": "fixed", "fixedColor": "green" } } ] }, { "matcher": { "id": "byName", "options": "WARN" }, "properties": [ { "id": "color", "value": { "mode": "fixed", "fixedColor": "yellow" } } ] }, { "matcher": { "id": "byName", "options": "ERROR" }, "properties": [ { "id": "color", "value": { "mode": "fixed", "fixedColor": "red" } } ] } ] } }, { "title": "Error Logs (Last Hour)", "type": "table", "gridPos": { "x": 8, "y": 12, "w": 16, "h": 8 }, "id": 3, "targets": [ { "expr": "{job=\"app_logs\"} | logfmt | level=\"ERROR\"", "refId": "A", "datasource": "Loki" } ], "options": { "showHeader": true }, "transformations": [ { "id": "labelsToFields", "options": {} } ] }, { "title": "Logs by Component", "type": "timeseries", "gridPos": { "x": 0, "y": 20, "w": 12, "h": 8 }, "id": 4, "targets": [ { "expr": "sum by (component) (rate({job=\"app_logs\"} | logfmt [1m]))", "refId": "A", "datasource": "Loki", "legendFormat": "{{component}}" } ], "fieldConfig": { "defaults": { "custom": { "drawStyle": "line", "lineInterpolation": "smooth", "fillOpacity": 10, "spanNulls": false, "showPoints": "never", "stacking": { "mode": "none" } }, "unit": "reqps" } } }, { "title": "Warning Logs Timeline", "type": "timeseries", "gridPos": { "x": 12, "y": 20, "w": 12, "h": 8 }, "id": 5, "targets": [ { "expr": "sum(count_over_time({job=\"app_logs\"} | logfmt | level=\"WARN\" [1m]))", "refId": "A", "datasource": "Loki", "legendFormat": "Warnings" } ], "fieldConfig": { "defaults": { "custom": { "drawStyle": "bars", "fillOpacity": 50 }, "color": { "mode": "fixed", "fixedColor": "yellow" } } } }, { "title": "Search Logs", "type": "logs", "gridPos": { "x": 0, "y": 28, "w": 24, "h": 10 }, "id": 6, "targets": [ { "expr": "{job=\"app_logs\"} |= \"$search_term\"", "refId": "A", "datasource": "Loki" } ], "options": { "showTime": true, "showLabels": true, "wrapLogMessage": true, "enableLogDetails": true } } ], "templating": { "list": [ { "name": "search_term", "type": "textbox", "label": "Search Term", "current": { "value": "", "text": "" } } ] }, "refresh": "30s" } }