Grafana dashboard: Grafana Loki Dashboard for NGINX Service Mesh
Description: Loki v2+ showcase using JSON NGINX access logs.

Start using Grafana Loki even faster in Grafana Cloud (free plan includes 50GB of Loki logs): [https://grafana.com/signup/cloud/connect-account](https://grafana.com/signup/cloud/connect-account?pg=lokidash)

This dashboard is designed for Grafana 8.0 and higher.

Required NGINX json log format configuration below. 

```cfg
log_format json_analytics escape=json '{'
                            '"msec": "$msec", ' # request unixtime in seconds with a milliseconds resolution
                            '"connection": "$connection", ' # connection serial number
                            '"connection_requests": "$connection_requests", ' # number of requests made in connection
                    '"pid": "$pid", ' # process pid
                    '"request_id": "$request_id", ' # the unique request id
                    '"request_length": "$request_length", ' # request length (including headers and body)
                    '"remote_addr": "$remote_addr", ' # client IP
                    '"remote_user": "$remote_user", ' # client HTTP username
                    '"remote_port": "$remote_port", ' # client port
                    '"time_local": "$time_local", '
                    '"time_iso8601": "$time_iso8601", ' # local time in the ISO 8601 standard format
                    '"request": "$request", ' # full path no arguments if the request
                    '"request_uri": "$request_uri", ' # full path and arguments if the request
                    '"args": "$args", ' # args
                    '"status": "$status", ' # response status code
                    '"body_bytes_sent": "$body_bytes_sent", ' # the number of body bytes exclude headers sent to a client
                    '"bytes_sent": "$bytes_sent", ' # the number of bytes sent to a client
                    '"http_referer": "$http_referer", ' # HTTP referer
                    '"http_user_agent": "$http_user_agent", ' # user agent
                    '"http_x_forwarded_for": "$http_x_forwarded_for", ' # http_x_forwarded_for
                    '"http_host": "$http_host", ' # the request Host: header
                    '"server_name": "$server_name", ' # the name of the vhost serving the request
                    '"request_time": "$request_time", ' # request processing time in seconds with msec resolution
                    '"upstream": "$upstream_addr", ' # upstream backend server for proxied requests
                    '"upstream_connect_time": "$upstream_connect_time", ' # upstream handshake time incl. TLS
                    '"upstream_header_time": "$upstream_header_time", ' # time spent receiving upstream headers
                    '"upstream_response_time": "$upstream_response_time", ' # time spend receiving upstream body
                    '"upstream_response_length": "$upstream_response_length", ' # upstream response length
                    '"upstream_cache_status": "$upstream_cache_status", ' # cache HIT/MISS where applicable
                    '"ssl_protocol": "$ssl_protocol", ' # TLS protocol
                    '"ssl_cipher": "$ssl_cipher", ' # TLS cipher
                    '"scheme": "$scheme", ' # http or https
                    '"request_method": "$request_method", ' # request method
                    '"server_protocol": "$server_protocol", ' # request protocol, like HTTP/1.1 or HTTP/2.0
                    '"pipe": "$pipe", ' # "p" if request was pipelined, "." otherwise
                    '"gzip_ratio": "$gzip_ratio", '
                    '"http_cf_ray": "$http_cf_ray",'
                    '"geoip_country_code": "$geoip_country_code"'
                    '}';

 access_log /var/log/nginx/json_access.log json_analytics;
```
For IP to country mapping, also enable the Geo_IP module:

```cfg
geoip_country /etc/nginx/GeoIP.dat;
geoip_city /etc/nginx/GeoIPCity.dat;
```
My promtail configuration:

```cfg
server:
  http_listen_port: 0
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: https://USER:PASSWORD@logs-prod-us-central1.grafana.net/api/prom/push

scrape_configs:
    - job_name: system
      pipeline_stages:
      - replace:
          expression: '(?:[0-9]{1,3}\.){3}([0-9]{1,3})'
          replace: '***'
      static_configs:
      - targets:
         - localhost
        labels:
         job: nginx_access_log
         host: appfelstrudel
         agent: promtail
         __path__: /var/log/nginx/*access.log
```

{
  "__inputs": [],
  "__requires": [
    {
      "type": "panel",
      "id": "geomap",
      "name": "Geomap",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.1.6"
    },
    {
      "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": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "Loki v2+ showcase using JSON NGINX access logs.",
  "editable": true,
  "gnetId": 12559,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1633505210001,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "datasource": "$datasource",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 24,
      "panels": [],
      "title": "KPI's",
      "type": "row"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 5,
        "x": 0,
        "y": 1
      },
      "hideTimeOverride": false,
      "id": 4,
      "interval": null,
      "maxDataPoints": 300,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "value"
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "sum by(host) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"}[$__interval]))  ",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": "24h",
      "timeShift": null,
      "title": "Total requests  ",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "rgba(110, 157, 228, 0.76)",
                "value": null
              },
              {
                "color": "rgba(73, 124, 202, 1)",
                "value": 20
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 7,
        "x": 5,
        "y": 1
      },
      "id": 5,
      "interval": null,
      "maxDataPoints": 20,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "sum by (status) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json |  __error__=\"\" [$__interval]))",
          "instant": false,
          "legendFormat": "HTTP Status: {{status}}",
          "range": true,
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Requests per status code",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-orange",
                "value": null
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 12,
        "y": 1
      },
      "id": 30,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "bytes_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"}[$__interval])",
          "instant": true,
          "legendFormat": "$label_value",
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "NGINX logs in bytes",
      "type": "stat"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 15,
        "y": 1
      },
      "id": 8,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "value"
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "sum by (host) (sum_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | unwrap body_bytes_sent |  __error__=\"\" [$__interval]))",
          "instant": true,
          "legendFormat": "Bytes sent",
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Total Bytes Sent",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": null,
      "description": "",
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 1
      },
      "id": 34,
      "options": {
        "content": "📊 Dashboard created by Ward Bekker (hope you like it!)\n\n🐦 Follow me on [Twitter](https://twitter.com/wardbekker) & [LinkedIn](https://www.linkedin.com/in/wardbekker/) for  Grafana Loki updates \n\n🎥 Check out my [Grafana Loki video's](https://www.youtube.com/playlist?list=PLDGkOdUX1UjqEzcxQrbROMy8DN7MZv_h4) on Youtube",
        "mode": "markdown"
      },
      "pluginVersion": "8.1.6",
      "transparent": true,
      "type": "text"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 5,
        "x": 0,
        "y": 5
      },
      "id": 22,
      "interval": "5m",
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "value"
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "count(sum by (remote_addr) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json |  __error__=\"\" [$__interval])))",
          "instant": true,
          "legendFormat": "",
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": "5m",
      "timeShift": null,
      "title": "Realtime visitors ",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-orange",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 12,
        "y": 5
      },
      "id": 31,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"}[$__interval])",
          "instant": true,
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "# NGINX log lines",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 15,
        "y": 5
      },
      "hideTimeOverride": true,
      "id": 19,
      "interval": null,
      "links": [],
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "max"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "value"
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "sum(count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | status >= 500 |__error__=\"\"[$__interval])) / (sum(count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | __error__=\"\"[$__interval]))/ 100)",
          "instant": false,
          "legendFormat": "",
          "range": true,
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "% of 5xx requests ",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple",
                "value": null
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 5
      },
      "hideTimeOverride": true,
      "id": 18,
      "interval": "10m",
      "links": [],
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "value"
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "sum(count_over_time(({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} |= \"Googlebot\")[$__interval])) / (sum(count_over_time(({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} != \"Googlebot\")[$__interval])) / 100)",
          "instant": true,
          "legendFormat": "",
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "% of requests by Googlebot",
      "type": "stat"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#96D98D",
                "value": null
              },
              {
                "color": "#73BF69",
                "value": 5
              },
              {
                "color": "#56A64B",
                "value": 10
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 0,
        "y": 9
      },
      "id": 14,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "basemap": {
          "config": {
            "server": "streets"
          },
          "type": "esri-xyz"
        },
        "controls": {
          "mouseWheelZoom": false,
          "showAttribution": true,
          "showDebug": false,
          "showScale": false,
          "showZoom": true
        },
        "layers": [
          {
            "config": {
              "color": {
                "fixed": "semi-dark-blue"
              },
              "fillOpacity": 0.3,
              "shape": "circle",
              "showLegend": true,
              "size": {
                "field": "Value",
                "fixed": 5,
                "max": 50,
                "min": 10
              }
            },
            "location": {
              "lookup": "Metric",
              "mode": "lookup"
            },
            "type": "markers"
          }
        ],
        "view": {
          "id": "zero",
          "lat": 0,
          "lon": 0,
          "zoom": 2
        }
      },
      "pluginVersion": "7.4.0",
      "targets": [
        {
          "expr": "sum by (geoip_country_code) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | geoip_country_code != \"\" | __error__=\"\" [$__interval]))",
          "instant": false,
          "legendFormat": "{{geoip_country_code}}",
          "range": true,
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Requests per Country",
      "transformations": [
        {
          "id": "seriesToRows",
          "options": {}
        }
      ],
      "type": "geomap"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-BlPu"
          },
          "custom": {
            "align": "center",
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [
            {
              "options": {
                "CN": {
                  "color": "transparent",
                  "index": 4,
                  "text": "🇨🇳CN"
                },
                "DE": {
                  "color": "transparent",
                  "index": 2,
                  "text": "🇩🇪DE"
                },
                "FR": {
                  "color": "transparent",
                  "index": 3,
                  "text": "🇫🇷FR"
                },
                "GB": {
                  "color": "transparent",
                  "index": 7,
                  "text": "🇬🇧GB"
                },
                "IN": {
                  "color": "transparent",
                  "index": 5,
                  "text": "🇮🇳IN"
                },
                "IT": {
                  "color": "transparent",
                  "index": 6,
                  "text": "🇮🇹IT"
                },
                "NL": {
                  "color": "transparent",
                  "index": 1,
                  "text": "🇳🇱NL"
                },
                "US": {
                  "color": "transparent",
                  "index": 0,
                  "text": "🇺🇸 US"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "transparent",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 3,
        "x": 12,
        "y": 9
      },
      "hideTimeOverride": true,
      "id": 32,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "showHeader": false,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Requests"
          }
        ]
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "topk(10, sum by (geoip_country_code) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | geoip_country_code != \"\" and  __error__=\"\" [$__interval])))",
          "instant": true,
          "legendFormat": "{{remote_addr}}",
          "maxLines": null,
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "timeShift": null,
      "title": "Top Countries",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": false,
              "Time": true,
              "Value #A": true
            },
            "indexByName": {
              "Time": 0,
              "Value #A": 3,
              "geoip_country_code": 2,
              "remote_addr": 1
            },
            "renameByName": {
              "Field": "IP Address",
              "Total": "Requests",
              "Value #A": "Requests",
              "geoip_country_code": "Country",
              "remote_addr": "IP Address "
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "gridPos": {
        "h": 11,
        "w": 9,
        "x": 15,
        "y": 9
      },
      "id": 11,
      "options": {
        "dedupStrategy": "signature",
        "enableLogDetails": false,
        "prettifyLogMessage": false,
        "showCommonLabels": false,
        "showLabels": false,
        "showTime": false,
        "sortOrder": "Descending",
        "wrapLogMessage": false
      },
      "targets": [
        {
          "expr": "{$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | line_format \"➡️ {{.request_method}} {{.request_uri}} with HTTP status: {{.status}} \"",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Recent requests",
      "type": "logs"
    },
    {
      "collapsed": false,
      "datasource": "$datasource",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 20
      },
      "id": 26,
      "panels": [],
      "title": "Request statistics over time",
      "type": "row"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 100,
            "gradientMode": "hue",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "log": 2,
              "type": "log"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 0.2
              },
              {
                "color": "red",
                "value": 0.3
              }
            ]
          },
          "unit": "s"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "95th percentile"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "max latency"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "super-light-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "max latency"
            },
            "properties": [
              {
                "id": "custom.fillOpacity",
                "value": 30
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 21
      },
      "id": 16,
      "interval": null,
      "maxDataPoints": 50,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "pluginVersion": "8.0.0-beta3",
      "targets": [
        {
          "expr": "quantile_over_time(0.95,{$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | unwrap request_time |  __error__=\"\"  [$__interval]) by (host)",
          "legendFormat": "95th percentile",
          "refId": "C"
        },
        {
          "expr": "max by (host) (max_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | unwrap request_time |  __error__=\"\"  [$__interval]))",
          "legendFormat": "max latency",
          "refId": "D"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "95th percentile of Request Time",
      "type": "timeseries"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 39,
            "gradientMode": "hue",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "log": 2,
              "type": "log"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "decimals": 0,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "HTTP Status 500"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-orange",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "{statuscode=\"200\"} 200"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "{statuscode=\"404\"} 404"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "semi-dark-purple",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "{statuscode=\"500\"} 500"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-red",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "HTTP Status 404"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "light-orange",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "HTTP Status 301"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "light-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "HTTP Status 200"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "semi-dark-blue",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 21
      },
      "id": 2,
      "interval": null,
      "maxDataPoints": 50,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "pluginVersion": "8.0.0-beta3",
      "targets": [
        {
          "expr": "sum by (status) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json |  __error__=\"\" [$__interval]))",
          "legendFormat": "HTTP Status {{status}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "HTTP status codes over time",
      "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": "timeseries"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 100,
            "gradientMode": "hue",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Bytes sent"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "light-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "appfelstrudel"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "yellow",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 21
      },
      "id": 9,
      "interval": null,
      "maxDataPoints": 50,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "pluginVersion": "8.0.0-beta3",
      "targets": [
        {
          "expr": "sum by (host) (sum_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json | status=200 | unwrap body_bytes_sent |  __error__=\"\" [$__interval]))",
          "legendFormat": "Bytes sent",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Bytes Sent",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "datasource": "$datasource",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 30
      },
      "id": 28,
      "panels": [],
      "title": "Acquisition and Behaviour",
      "type": "row"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Requests"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "gradient-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-BlPu"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Requests"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 300
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 0,
        "y": 31
      },
      "id": 6,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Requests"
          }
        ]
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "topk(10, sum by (http_referer) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json |  http_referer != \"\" and http_referer !~ \".*?$host.*?\" and http_referer !~ \".*?\\\\*\\\\*\\\\*.*?\" | __error__=\"\" [15m])))",
          "instant": true,
          "legendFormat": "{{http_referer}}",
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "timeShift": null,
      "title": "Top 10 HTTP Referers",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "indexByName": {},
            "renameByName": {
              "Field": "Referer",
              "Total": "Requests",
              "Value #A": "Requests",
              "http_referer": "HTTP Referrer"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "displayMode": "auto",
            "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": 31
      },
      "id": 7,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Requests"
          }
        ]
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "topk(10, sum by (http_user_agent) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json |  __error__=\"\" [15m])))",
          "instant": true,
          "legendFormat": "{{http_user_agent}}",
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "timeShift": null,
      "title": "Top 10 User Agents",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": false,
              "Time": true
            },
            "indexByName": {},
            "renameByName": {
              "Field": "Agent",
              "Total": "Requests",
              "Value #A": "Requests",
              "http_user_agent": "User agent"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [
            {
              "options": {
                "NL": {
                  "index": 1,
                  "text": "🇳🇱"
                },
                "US": {
                  "index": 0,
                  "text": "🇺🇸"
                }
              },
              "type": "value"
            }
          ],
          "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"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Country"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 74
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 9,
        "x": 0,
        "y": 37
      },
      "id": 3,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Requests"
          }
        ]
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "topk(10, sum by (remote_addr, geoip_country_code) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} | json |  __error__=\"\" [15m])))",
          "instant": true,
          "legendFormat": "{{remote_addr}}",
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "timeShift": null,
      "title": "Top 10 visitor IPs",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": false,
              "Time": true
            },
            "indexByName": {
              "Time": 0,
              "Value #A": 3,
              "geoip_country_code": 2,
              "remote_addr": 1
            },
            "renameByName": {
              "Field": "IP Address",
              "Total": "Requests",
              "Value #A": "Requests",
              "geoip_country_code": "Country",
              "remote_addr": "IP Address "
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "$datasource",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "displayMode": "auto",
            "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": 15,
        "x": 9,
        "y": 37
      },
      "id": 12,
      "interval": null,
      "maxDataPoints": 1,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Requests"
          }
        ]
      },
      "pluginVersion": "8.1.6",
      "targets": [
        {
          "expr": "topk(10, sum by (request_uri) (count_over_time({$label_name=~\"$label_value\", job=~\"$job\", instance=~\"$instance\"} !~ `\\.ico|\\.svg|\\.css|\\.png|\\.txt|\\.js|\\.xml` | json | status = 200 and request_uri != \"/\" | __error__=\"\" [15m])))",
          "instant": true,
          "legendFormat": "{{request_uri}}",
          "range": false,
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "timeShift": null,
      "title": "Top 10 Requested Pages",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "indexByName": {},
            "renameByName": {
              "Field": "Page",
              "Time": "",
              "Total": "",
              "Value #A": "Requests",
              "request_uri": "Path"
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 30,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "LokiNGINX",
          "value": "LokiNGINX"
        },
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Datasource",
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "loki",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$datasource",
        "definition": "label_names()",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Label Name",
        "multi": false,
        "name": "label_name",
        "options": [],
        "query": "label_names()",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$datasource",
        "definition": "label_values($label_name)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Label Value",
        "multi": true,
        "name": "label_value",
        "options": [],
        "query": "label_values($label_name)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$datasource",
        "definition": "label_values({$label_name=~\"$label_value\"}, job)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Job",
        "multi": true,
        "name": "job",
        "options": [],
        "query": "label_values({$label_name=~\"$label_value\"}, job)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$datasource",
        "definition": "label_values({$label_name=~\"$label_value\"}, instance)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Instance",
        "multi": true,
        "name": "instance",
        "options": [],
        "query": "label_values({$label_name=~\"$label_value\"}, instance)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "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": "Grafana Loki Dashboard for NGINX Service Mesh",
  "uid": "Nz6kKgtGj",
  "version": 52
}