Created
June 11, 2020 19:34
-
-
Save wardbekker/28524c0497fb2b7eb36cfa452c1c63ce to your computer and use it in GitHub Desktop.
Loki Nginx Web Analytics Dashboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"annotations": { | |
"list": [ | |
{ | |
"builtIn": 1, | |
"datasource": "-- Grafana --", | |
"enable": true, | |
"hide": true, | |
"iconColor": "rgba(0, 211, 255, 1)", | |
"name": "Annotations & Alerts", | |
"type": "dashboard" | |
} | |
] | |
}, | |
"editable": true, | |
"gnetId": null, | |
"graphTooltip": 0, | |
"links": [], | |
"panels": [ | |
{ | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": { | |
"align": null | |
}, | |
"mappings": [], | |
"thresholds": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
} | |
] | |
}, | |
"unit": "short" | |
}, | |
"overrides": [ | |
{ | |
"matcher": { | |
"id": "byName", | |
"options": "{statuscode=\"500\"} 500" | |
}, | |
"properties": [ | |
{ | |
"id": "thresholds", | |
"value": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
}, | |
{ | |
"color": "red", | |
"value": 20 | |
} | |
] | |
} | |
} | |
] | |
}, | |
{ | |
"matcher": { | |
"id": "byName", | |
"options": "{statuscode=\"404\"} 404" | |
}, | |
"properties": [ | |
{ | |
"id": "thresholds", | |
"value": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
}, | |
{ | |
"color": "red", | |
"value": 20 | |
} | |
] | |
} | |
} | |
] | |
} | |
] | |
}, | |
"gridPos": { | |
"h": 5, | |
"w": 15, | |
"x": 0, | |
"y": 0 | |
}, | |
"id": 5, | |
"interval": "30s", | |
"options": { | |
"colorMode": "background", | |
"graphMode": "area", | |
"justifyMode": "auto", | |
"orientation": "auto", | |
"reduceOptions": { | |
"calcs": [ | |
"sum" | |
], | |
"fields": "", | |
"values": false | |
} | |
}, | |
"pluginVersion": "7.0.3", | |
"targets": [ | |
{ | |
"expr": "sum by (statuscode) (count_over_time({filename=\"/var/log/nginx/access.log\"} | regexp \"HTTP/1.1\\\" (?P<statuscode>\\\\d{3}) \"[$__interval]))", | |
"refId": "A" | |
} | |
], | |
"timeFrom": null, | |
"timeShift": null, | |
"title": "Requests per status code", | |
"transformations": [], | |
"type": "stat" | |
}, | |
{ | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": { | |
"align": null | |
}, | |
"mappings": [], | |
"thresholds": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "purple", | |
"value": null | |
} | |
] | |
}, | |
"unit": "short" | |
}, | |
"overrides": [] | |
}, | |
"gridPos": { | |
"h": 5, | |
"w": 5, | |
"x": 15, | |
"y": 0 | |
}, | |
"id": 4, | |
"interval": "30s", | |
"options": { | |
"colorMode": "background", | |
"graphMode": "area", | |
"justifyMode": "auto", | |
"orientation": "auto", | |
"reduceOptions": { | |
"calcs": [ | |
"sum" | |
], | |
"fields": "", | |
"values": false | |
} | |
}, | |
"pluginVersion": "7.0.3", | |
"targets": [ | |
{ | |
"expr": "count_over_time({filename=\"/var/log/nginx/access.log\"}[$__interval])", | |
"refId": "A" | |
} | |
], | |
"timeFrom": null, | |
"timeShift": null, | |
"title": "Total requests ", | |
"transformations": [], | |
"type": "stat" | |
}, | |
{ | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": { | |
"align": null | |
}, | |
"mappings": [], | |
"thresholds": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
} | |
] | |
}, | |
"unit": "decbytes" | |
}, | |
"overrides": [ | |
{ | |
"matcher": { | |
"id": "byName", | |
"options": "IP Address" | |
}, | |
"properties": [ | |
{ | |
"id": "custom.width", | |
"value": 410 | |
} | |
] | |
} | |
] | |
}, | |
"gridPos": { | |
"h": 5, | |
"w": 4, | |
"x": 20, | |
"y": 0 | |
}, | |
"id": 8, | |
"options": { | |
"colorMode": "background", | |
"graphMode": "none", | |
"justifyMode": "auto", | |
"orientation": "auto", | |
"reduceOptions": { | |
"calcs": [ | |
"sum" | |
], | |
"fields": "", | |
"values": false | |
} | |
}, | |
"pluginVersion": "7.0.3", | |
"targets": [ | |
{ | |
"expr": "sum_over_time({filename=\"/var/log/nginx/access.log\"} | regexp \"HTTP\\\\/1\\\\.1\\\" (?P<statuscode>\\\\d{3}) (?P<value>\\\\d+) (?P<refferer>\\\".*?\\\") \\\"(?P<useragent>.*)\\\"\"[$__interval])", | |
"refId": "A" | |
} | |
], | |
"timeFrom": null, | |
"timeShift": null, | |
"title": "Total Bytes Sent", | |
"transformations": [ | |
{ | |
"id": "reduce", | |
"options": { | |
"reducers": [ | |
"sum" | |
] | |
} | |
}, | |
{ | |
"id": "organize", | |
"options": { | |
"excludeByName": { | |
"Field": false | |
}, | |
"indexByName": {}, | |
"renameByName": { | |
"Field": "Agent", | |
"Total": "Requests" | |
} | |
} | |
} | |
], | |
"type": "stat" | |
}, | |
{ | |
"aliasColors": { | |
"{statuscode=\"200\"} 200": "green", | |
"{statuscode=\"404\"} 404": "semi-dark-purple", | |
"{statuscode=\"500\"} 500": "dark-red" | |
}, | |
"bars": false, | |
"dashLength": 10, | |
"dashes": false, | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": {} | |
}, | |
"overrides": [] | |
}, | |
"fill": 1, | |
"fillGradient": 10, | |
"gridPos": { | |
"h": 9, | |
"w": 7, | |
"x": 0, | |
"y": 5 | |
}, | |
"hiddenSeries": false, | |
"id": 2, | |
"interval": "30s", | |
"legend": { | |
"avg": false, | |
"current": false, | |
"max": false, | |
"min": false, | |
"show": true, | |
"total": false, | |
"values": false | |
}, | |
"lines": true, | |
"linewidth": 1, | |
"nullPointMode": "connected", | |
"options": { | |
"dataLinks": [] | |
}, | |
"percentage": true, | |
"pointradius": 2, | |
"points": false, | |
"renderer": "flot", | |
"seriesOverrides": [], | |
"spaceLength": 10, | |
"stack": true, | |
"steppedLine": false, | |
"targets": [ | |
{ | |
"expr": "sum by (statuscode) (count_over_time({filename=\"/var/log/nginx/access.log\"} | regexp \"HTTP/1.1\\\" (?P<statuscode>\\\\d{3}) \"[$__interval]))", | |
"refId": "A" | |
} | |
], | |
"thresholds": [], | |
"timeFrom": null, | |
"timeRegions": [], | |
"timeShift": null, | |
"title": "HTTP requests", | |
"tooltip": { | |
"shared": true, | |
"sort": 0, | |
"value_type": "individual" | |
}, | |
"type": "graph", | |
"xaxis": { | |
"buckets": null, | |
"mode": "time", | |
"name": null, | |
"show": true, | |
"values": [] | |
}, | |
"yaxes": [ | |
{ | |
"$$hashKey": "object:448", | |
"decimals": 0, | |
"format": "short", | |
"label": null, | |
"logBase": 1, | |
"max": "100", | |
"min": null, | |
"show": true | |
}, | |
{ | |
"$$hashKey": "object:449", | |
"format": "short", | |
"label": null, | |
"logBase": 1, | |
"max": null, | |
"min": null, | |
"show": true | |
} | |
], | |
"yaxis": { | |
"align": false, | |
"alignLevel": null | |
} | |
}, | |
{ | |
"aliasColors": { | |
"appfelstrudel": "yellow" | |
}, | |
"bars": false, | |
"dashLength": 10, | |
"dashes": false, | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": { | |
"align": null | |
}, | |
"mappings": [], | |
"thresholds": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
} | |
] | |
}, | |
"unit": "decbytes" | |
}, | |
"overrides": [ | |
{ | |
"matcher": { | |
"id": "byName", | |
"options": "IP Address" | |
}, | |
"properties": [ | |
{ | |
"id": "custom.width", | |
"value": 410 | |
} | |
] | |
} | |
] | |
}, | |
"fill": 10, | |
"fillGradient": 10, | |
"gridPos": { | |
"h": 9, | |
"w": 8, | |
"x": 7, | |
"y": 5 | |
}, | |
"hiddenSeries": false, | |
"id": 9, | |
"interval": "30s", | |
"legend": { | |
"avg": false, | |
"current": false, | |
"max": false, | |
"min": false, | |
"show": true, | |
"total": false, | |
"values": false | |
}, | |
"lines": true, | |
"linewidth": 1, | |
"nullPointMode": "null", | |
"options": { | |
"dataLinks": [] | |
}, | |
"percentage": false, | |
"pluginVersion": "7.0.3", | |
"pointradius": 2, | |
"points": false, | |
"renderer": "flot", | |
"seriesOverrides": [], | |
"spaceLength": 10, | |
"stack": false, | |
"steppedLine": false, | |
"targets": [ | |
{ | |
"expr": "sum by (host) (sum_over_time({filename=\"/var/log/nginx/access.log\"} | regexp \"HTTP\\\\/1\\\\.1\\\" (?P<statuscode>\\\\d{3}) (?P<value>\\\\d+) (?P<refferer>\\\".*?\\\") \\\"(?P<useragent>.*)\\\"\"[$__interval]))", | |
"refId": "A" | |
} | |
], | |
"thresholds": [], | |
"timeFrom": null, | |
"timeRegions": [], | |
"timeShift": null, | |
"title": "Bytes Sent", | |
"tooltip": { | |
"shared": true, | |
"sort": 0, | |
"value_type": "individual" | |
}, | |
"transformations": [], | |
"type": "graph", | |
"xaxis": { | |
"buckets": null, | |
"mode": "time", | |
"name": null, | |
"show": true, | |
"values": [] | |
}, | |
"yaxes": [ | |
{ | |
"$$hashKey": "object:499", | |
"format": "decbytes", | |
"label": null, | |
"logBase": 1, | |
"max": null, | |
"min": null, | |
"show": true | |
}, | |
{ | |
"$$hashKey": "object:500", | |
"format": "short", | |
"label": null, | |
"logBase": 1, | |
"max": null, | |
"min": null, | |
"show": true | |
} | |
], | |
"yaxis": { | |
"align": false, | |
"alignLevel": null | |
} | |
}, | |
{ | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": { | |
"align": null | |
}, | |
"mappings": [], | |
"thresholds": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
}, | |
{ | |
"color": "red", | |
"value": 80 | |
} | |
] | |
} | |
}, | |
"overrides": [ | |
{ | |
"matcher": { | |
"id": "byName", | |
"options": "Requests" | |
}, | |
"properties": [ | |
{ | |
"id": "custom.width", | |
"value": 100 | |
} | |
] | |
} | |
] | |
}, | |
"gridPos": { | |
"h": 9, | |
"w": 9, | |
"x": 15, | |
"y": 5 | |
}, | |
"id": 3, | |
"interval": "30s", | |
"options": { | |
"showHeader": true, | |
"sortBy": [ | |
{ | |
"desc": true, | |
"displayName": "Requests" | |
} | |
] | |
}, | |
"pluginVersion": "7.0.3", | |
"targets": [ | |
{ | |
"expr": "topk(5, sum by (ipaddress) (count_over_time({filename=\"/var/log/nginx/access.log\"} | regexp \"(?P<ipaddress>\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})\"[$__interval])))", | |
"refId": "A" | |
} | |
], | |
"timeFrom": null, | |
"timeShift": null, | |
"title": "Top IPs", | |
"transformations": [ | |
{ | |
"id": "reduce", | |
"options": { | |
"reducers": [ | |
"sum" | |
] | |
} | |
}, | |
{ | |
"id": "organize", | |
"options": { | |
"excludeByName": { | |
"Field": false | |
}, | |
"indexByName": {}, | |
"renameByName": { | |
"Field": "IP Address", | |
"Total": "Requests" | |
} | |
} | |
} | |
], | |
"type": "table" | |
}, | |
{ | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": { | |
"align": null | |
}, | |
"mappings": [], | |
"thresholds": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
}, | |
{ | |
"color": "red", | |
"value": 80 | |
} | |
] | |
} | |
}, | |
"overrides": [ | |
{ | |
"matcher": { | |
"id": "byName", | |
"options": "Requests" | |
}, | |
"properties": [ | |
{ | |
"id": "custom.width", | |
"value": 100 | |
} | |
] | |
} | |
] | |
}, | |
"gridPos": { | |
"h": 6, | |
"w": 15, | |
"x": 0, | |
"y": 14 | |
}, | |
"id": 12, | |
"interval": "30s", | |
"options": { | |
"showHeader": true, | |
"sortBy": [ | |
{ | |
"desc": true, | |
"displayName": "Requests" | |
} | |
] | |
}, | |
"pluginVersion": "7.0.3", | |
"targets": [ | |
{ | |
"expr": "topk(5,sum by (path) (count_over_time({filename=\"/var/log/nginx/access.log\"} | regexp \"[GET|POST] (?P<path>.*?) HTTP\"[$__interval])))", | |
"refId": "A" | |
} | |
], | |
"timeFrom": null, | |
"timeShift": null, | |
"title": "Top Requested Pages", | |
"transformations": [ | |
{ | |
"id": "reduce", | |
"options": { | |
"reducers": [ | |
"sum" | |
] | |
} | |
}, | |
{ | |
"id": "organize", | |
"options": { | |
"excludeByName": { | |
"Field": false | |
}, | |
"indexByName": {}, | |
"renameByName": { | |
"Field": "Agent", | |
"Total": "Requests" | |
} | |
} | |
} | |
], | |
"type": "table" | |
}, | |
{ | |
"datasource": "LokiNGINXExperimental", | |
"fieldConfig": { | |
"defaults": { | |
"custom": {} | |
}, | |
"overrides": [] | |
}, | |
"gridPos": { | |
"h": 19, | |
"w": 9, | |
"x": 15, | |
"y": 14 | |
}, | |
"id": 11, | |
"options": { | |
"showLabels": false, | |
"showTime": false, | |
"sortOrder": "Descending", | |
"wrapLogMessage": false | |
}, | |
"targets": [ | |
{ | |
"expr": "{filename=\"/var/log/nginx/access.log\"}", | |
"refId": "A" | |
} | |
], | |
"timeFrom": null, | |
"timeShift": null, | |
"title": "Logs", | |
"type": "logs" | |
}, | |
{ | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": { | |
"align": null | |
}, | |
"mappings": [], | |
"thresholds": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
}, | |
{ | |
"color": "red", | |
"value": 80 | |
} | |
] | |
} | |
}, | |
"overrides": [ | |
{ | |
"matcher": { | |
"id": "byName", | |
"options": "Requests" | |
}, | |
"properties": [ | |
{ | |
"id": "custom.width", | |
"value": 100 | |
} | |
] | |
} | |
] | |
}, | |
"gridPos": { | |
"h": 6, | |
"w": 15, | |
"x": 0, | |
"y": 20 | |
}, | |
"id": 7, | |
"interval": "30s", | |
"options": { | |
"showHeader": true, | |
"sortBy": [ | |
{ | |
"desc": true, | |
"displayName": "Requests" | |
} | |
] | |
}, | |
"pluginVersion": "7.0.3", | |
"targets": [ | |
{ | |
"expr": "topk(10, sum by (useragent) (count_over_time({filename=\"/var/log/nginx/access.log\"} | regexp \"HTTP\\\\/1\\\\.1\\\" (?P<statuscode>\\\\d{3}) (?P<bytessent>\\\\d+) (?P<refferer>\\\".*?\\\") \\\"(?P<useragent>.*)\\\"\"[$__interval])))", | |
"refId": "A" | |
} | |
], | |
"timeFrom": null, | |
"timeShift": null, | |
"title": "Top User Agents", | |
"transformations": [ | |
{ | |
"id": "reduce", | |
"options": { | |
"reducers": [ | |
"sum" | |
] | |
} | |
}, | |
{ | |
"id": "organize", | |
"options": { | |
"excludeByName": { | |
"Field": false | |
}, | |
"indexByName": {}, | |
"renameByName": { | |
"Field": "Agent", | |
"Total": "Requests" | |
} | |
} | |
} | |
], | |
"type": "table" | |
}, | |
{ | |
"datasource": "LokiNGINXExperimental", | |
"description": "", | |
"fieldConfig": { | |
"defaults": { | |
"custom": { | |
"align": null | |
}, | |
"mappings": [], | |
"thresholds": { | |
"mode": "absolute", | |
"steps": [ | |
{ | |
"color": "green", | |
"value": null | |
}, | |
{ | |
"color": "red", | |
"value": 80 | |
} | |
] | |
} | |
}, | |
"overrides": [ | |
{ | |
"matcher": { | |
"id": "byName", | |
"options": "Requests" | |
}, | |
"properties": [ | |
{ | |
"id": "custom.width", | |
"value": 100 | |
} | |
] | |
} | |
] | |
}, | |
"gridPos": { | |
"h": 7, | |
"w": 15, | |
"x": 0, | |
"y": 26 | |
}, | |
"id": 6, | |
"interval": "30ms", | |
"options": { | |
"showHeader": true, | |
"sortBy": [ | |
{ | |
"desc": true, | |
"displayName": "Requests" | |
} | |
] | |
}, | |
"pluginVersion": "7.0.3", | |
"targets": [ | |
{ | |
"expr": "topk(5, sum by (refferer) (count_over_time({filename=\"/var/log/nginx/access.log\"} | regexp \"HTTP\\\\/1\\\\.1\\\" (?P<statuscode>\\\\d{3}) (?P<bytessent>\\\\d+) (?P<refferer>\\\".*?\\\") \\\"(?P<useragent>.*)\\\"\"[$__interval])))", | |
"refId": "A" | |
} | |
], | |
"timeFrom": null, | |
"timeShift": null, | |
"title": "Referrer", | |
"transformations": [ | |
{ | |
"id": "reduce", | |
"options": { | |
"reducers": [ | |
"sum" | |
] | |
} | |
}, | |
{ | |
"id": "organize", | |
"options": { | |
"excludeByName": {}, | |
"indexByName": {}, | |
"renameByName": { | |
"Field": "IP Address", | |
"Total": "Requests" | |
} | |
} | |
} | |
], | |
"type": "table" | |
} | |
], | |
"refresh": false, | |
"schemaVersion": 25, | |
"style": "dark", | |
"tags": [], | |
"templating": { | |
"list": [] | |
}, | |
"time": { | |
"from": "now-1h", | |
"to": "now" | |
}, | |
"timepicker": { | |
"refresh_intervals": [ | |
"10s", | |
"30s", | |
"1m", | |
"5m", | |
"15m", | |
"30m", | |
"1h", | |
"2h", | |
"1d" | |
] | |
}, | |
"timezone": "", | |
"title": "Web Analytics Dashboard", | |
"uid": "Y8z3IOiGz", | |
"version": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment