Grafana dashboard: Loki v2 Web Analytics Dashboard for NGINX
Description: Loki version 2 showcase using JSON NGINX access logs.


{
  "__inputs": [
    {
      "name": "DS_LOKI",
      "label": "loki-datasource",
      "description": "",
      "type": "datasource",
      "pluginId": "loki",
      "pluginName": "Loki"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.0.0"
    },
    {
      "type": "panel",
      "id": "grafana-worldmap-panel",
      "name": "Worldmap Panel",
      "version": "0.3.2"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "logs",
      "name": "Logs",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "loki",
      "name": "Loki",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Loki version 2 showcase using JSON NGINX access logs.",
  "editable": true,
  "gnetId": 13740,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1610701962573,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "datasource": "${DS_LOKI}",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 24,
      "panels": [],
      "title": "KPI's",
      "type": "row"
    },
    {
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 1
      },
      "id": 4,
      "interval": "30s",
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": "sum by(host) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"}[$__interval]))  ",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": "24h",
      "timeShift": null,
      "title": "Total requests  ",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "light-blue",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 9,
        "x": 6,
        "y": 1
      },
      "id": 5,
      "interval": "30s",
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": "sum by (status) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json |  __error__=\"\" [$__interval]))",
          "legendFormat": "HTTP Status: {{status}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Requests per status code",
      "transformations": [],
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 5,
        "x": 15,
        "y": 1
      },
      "id": 19,
      "interval": null,
      "links": [],
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": " sum(rate({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json | status >= 500 |__error__=\"\"[$__interval])) / (sum(rate({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json | __error__=\"\"[$__interval])) / 100)",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "% of 5xx requests ",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 1
      },
      "id": 18,
      "interval": "10m",
      "links": [],
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": " sum(rate(({job=\"nginx_access_log\", host=\"$host\"} |= \"Googlebot\")[$__interval])) / (sum(rate(({job=\"nginx_access_log\", host=\"$host\"} != \"Googlebot\")[$__interval])) / 100)",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "% of requests by Googlebot",
      "type": "stat"
    },
    {
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Requests"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 5
      },
      "id": 22,
      "interval": "5m",
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": "count(sum by (remote_addr) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json |  __error__=\"\" [5m])))",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": "5m",
      "timeShift": null,
      "title": "Users right now",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "IP Address"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 410
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 4,
        "w": 9,
        "x": 15,
        "y": 5
      },
      "id": 8,
      "interval": "10m",
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": "sum by (host) (sum_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json | status=200 | unwrap body_bytes_sent |  __error__=\"\" [$__interval]))",
          "legendFormat": "Bytes sent",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Total Bytes Sent",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "reducers": [
              "sum"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Total": "Bytes Sent"
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "circleMaxSize": "50",
      "circleMinSize": "15",
      "colors": [
        "#96D98D",
        "#37872D",
        "#19730E"
      ],
      "datasource": "${DS_LOKI}",
      "decimals": null,
      "description": "",
      "esMetric": "Count",
      "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": 10,
        "w": 15,
        "x": 0,
        "y": 9
      },
      "hideEmpty": false,
      "hideZero": false,
      "id": 14,
      "initialZoom": "2",
      "interval": "30s",
      "locationData": "countries",
      "mapCenter": "(0°, 0°)",
      "mapCenterLatitude": 0,
      "mapCenterLongitude": 0,
      "maxDataPoints": 1,
      "mouseWheelZoom": false,
      "pluginVersion": "7.0.3",
      "showLegend": true,
      "stickyLabels": true,
      "tableQueryOptions": {
        "geohashField": "geohash",
        "latitudeField": "latitude",
        "longitudeField": "longitude",
        "metricField": "metric",
        "queryType": "geohash"
      },
      "targets": [
        {
          "expr": "sum by (geoip_country_code) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json | __error__=\"\" [1m]))",
          "legendFormat": "{{geoip_country_code}}",
          "refId": "A"
        }
      ],
      "thresholds": "5,10",
      "timeFrom": "15m",
      "timeShift": null,
      "title": "Countries right now",
      "transformations": [],
      "type": "grafana-worldmap-panel",
      "unitPlural": "",
      "unitSingle": "",
      "valueName": "total"
    },
    {
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 9,
        "x": 15,
        "y": 9
      },
      "id": 11,
      "options": {
        "showLabels": false,
        "showTime": false,
        "sortOrder": "Descending",
        "wrapLogMessage": false
      },
      "targets": [
        {
          "expr": "{filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json | line_format \"request for {{.request_uri}} with HTTP status: {{.status}} \"",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Recent requests",
      "type": "logs"
    },
    {
      "collapsed": false,
      "datasource": "${DS_LOKI}",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 19
      },
      "id": 26,
      "panels": [],
      "title": "Request statistics over time",
      "type": "row"
    },
    {
      "aliasColors": {
        "95th percentile": "blue",
        "max latency": "super-light-blue"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "unit": "s"
        },
        "overrides": []
      },
      "fill": 5,
      "fillGradient": 9,
      "gridPos": {
        "h": 9,
        "w": 7,
        "x": 0,
        "y": 20
      },
      "hiddenSeries": false,
      "id": 16,
      "interval": "30s",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.3.6",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:232",
          "alias": "max latency",
          "dashes": true,
          "fillGradient": 3
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "quantile_over_time(0.95,{filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json | unwrap request_time |  __error__=\"\"  [$__interval]) by (host)",
          "legendFormat": "95th percentile",
          "refId": "C"
        },
        {
          "expr": "max by (host) (max_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json | unwrap request_time |  __error__=\"\"  [$__interval]))",
          "legendFormat": "max latency",
          "refId": "D"
        }
      ],
      "thresholds": [
        {
          "$$hashKey": "object:168",
          "colorMode": "critical",
          "fill": true,
          "line": true,
          "op": "gt",
          "value": 0.3,
          "yaxis": "left"
        }
      ],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "95th percentile of Request Time",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:178",
          "format": "s",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:179",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "{statuscode=\"200\"} 200": "green",
        "{statuscode=\"404\"} 404": "semi-dark-purple",
        "{statuscode=\"500\"} 500": "dark-red"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 10,
      "gridPos": {
        "h": 9,
        "w": 9,
        "x": 7,
        "y": 20
      },
      "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": {
        "alertThreshold": true
      },
      "percentage": true,
      "pluginVersion": "7.3.6",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": true,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum by (status) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json |  __error__=\"\" [$__interval]))",
          "legendFormat": "HTTP Status {{status}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "HTTP requests",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Time",
                "HTTP Status 200",
                "HTTP Status 301",
                "HTTP Status 304",
                "HTTP Status 404",
                "HTTP Status 406",
                "HTTP Status 500"
              ]
            }
          }
        }
      ],
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:271",
          "decimals": 0,
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": "100",
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:272",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "Bytes sent": "light-blue",
        "appfelstrudel": "yellow"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fill": 10,
      "fillGradient": 10,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 20
      },
      "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": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.3.6",
      "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/json_access.log\", host=\"$host\"} | json | status=200 | unwrap body_bytes_sent |  __error__=\"\" [$__interval]))",
          "legendFormat": "Bytes sent",
          "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:72",
          "format": "decbytes",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:73",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "collapsed": false,
      "datasource": "${DS_LOKI}",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 29
      },
      "id": 28,
      "panels": [],
      "title": "Acquisition and Behaviour",
      "type": "row"
    },
    {
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Requests"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 300
              },
              {
                "id": "custom.displayMode",
                "value": "gradient-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-BlPu"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 0,
        "y": 30
      },
      "id": 7,
      "interval": "1h",
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Requests"
          }
        ]
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": "topk(10, sum by (http_user_agent) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json |  __error__=\"\" [$__interval])))",
          "legendFormat": "{{http_user_agent}}",
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "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": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Requests"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 300
              },
              {
                "id": "custom.displayMode",
                "value": "gradient-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-BlPu"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 15,
        "x": 9,
        "y": 30
      },
      "id": 6,
      "interval": "1h",
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Requests"
          }
        ]
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": "topk(20, sum by (http_referer) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json |  http_referer != \"\" and http_referer !~ \".*?$host.*?\" | __error__=\"\" [$__interval])))",
          "legendFormat": "{{http_referer}}",
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "Top HTTP Referers",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "reducers": [
              "sum"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Field": "Referer",
              "Total": "Requests"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Requests"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 300
              },
              {
                "id": "custom.displayMode",
                "value": "gradient-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-BlPu"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 9,
        "x": 0,
        "y": 36
      },
      "id": 3,
      "interval": "30m",
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Requests"
          }
        ]
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": "topk(10, sum by (remote_addr) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json |  __error__=\"\" [$__interval])))",
          "legendFormat": "{{remote_addr}}",
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "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": "${DS_LOKI}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Total"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 300
              },
              {
                "id": "custom.displayMode",
                "value": "gradient-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-BlPu"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 15,
        "x": 9,
        "y": 36
      },
      "id": 12,
      "interval": "5m",
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Total"
          }
        ]
      },
      "pluginVersion": "7.3.6",
      "targets": [
        {
          "expr": "topk(5,sum by (request_uri) (count_over_time({filename=\"/var/log/nginx/json_access.log\", host=\"$host\"} | json | request_uri != \"/\" | __error__=\"\" [$__interval])))",
          "legendFormat": "{{request_uri}}",
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "Top Requested Pages",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "reducers": [
              "sum"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Field": "Page",
              "Total": ""
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 26,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_LOKI}",
        "definition": "label_values({filename=\"/var/log/nginx/json_access.log\"}, host)",
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "host",
        "multi": false,
        "name": "host",
        "options": [],
        "query": "label_values({filename=\"/var/log/nginx/json_access.log\"}, host)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Loki v2 Web Analytics Dashboard for NGINX",
  "uid": "Nz6kKgtGk",
  "version": 3
}