Grafana dashboard: Elasticsearch Nginx Logs
Description: Browse, analyze logs in Elasticsearchstatus_codes, pie-chart, top 10 clientip, line-chart,word-map and etc...

# ELK 5.X

# nginx access log format
```
log_format main   '{"@timestamp":"$time_iso8601",'
                        '"@source":"$server_addr",'
                        '"hostname":"$hostname",'
                        '"ip":"$http_x_forwarded_for",'
                        '"client":"$remote_addr",'
                        '"request_method":"$request_method",'
                        '"scheme":"$scheme",'
                        '"domain":"$server_name",'
                        '"referer":"$http_referer",'
                        '"request":"$request_uri",'
                        '"args":"$args",'
                        '"size":$body_bytes_sent,'
                        '"status": $status,'
                        '"responsetime":$request_time,'
                        '"upstreamtime":"$upstream_response_time",'
                        '"upstreamaddr":"$upstream_addr",'
                        '"http_user_agent":"$http_user_agent",'
                        '"https":"$https"'
                        '}';
```

# Logstash nginx_access.conf 
```
input {
    file {
        #这里根据自己日志命名使用正则匹配所有域名访问日志
        path => [ "/usr/local/nginx/logs/*_access.log" ]
        ignore_older => 0
	codec => json
    }
}

filter {
    mutate {
      convert => [ "status","integer" ]
      convert => [ "size","integer" ]
      convert => [ "upstreatime","float" ]
      remove_field => "message"
    }
    geoip {
        source => "ip"
    }


}
output {
    elasticsearch {
        hosts => "127.0.0.1:9200"
        index => "logstash-nginx-access-%{+YYYY.MM.dd}"
    }
#    stdout {codec => rubydebug}
}
```


{
  "__inputs": [
    {
      "name": "DS_NGINX-ACCESS-LOG",
      "label": "nginx-access-log",
      "description": "",
      "type": "datasource",
      "pluginId": "elasticsearch",
      "pluginName": "Elasticsearch"
    }
  ],
  "__requires": [
    {
      "type": "datasource",
      "id": "elasticsearch",
      "name": "Elasticsearch",
      "version": "3.0.0"
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "4.4.1"
    },
    {
      "type": "panel",
      "id": "grafana-piechart-panel",
      "name": "Pie Chart",
      "version": "1.1.5"
    },
    {
      "type": "panel",
      "id": "grafana-worldmap-panel",
      "name": "Worldmap Panel",
      "version": "0.0.17"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": []
  },
  "description": "Browse, analyze logs in Elasticsearchstatus_codes, pie-chart, top 10 clientip, line-chart,word-map and etc...",
  "editable": true,
  "gnetId": 2292,
  "graphTooltip": 0,
  "hideControls": false,
  "id": null,
  "links": [
    {
      "icon": "external link",
      "tags": [],
      "targetBlank": true,
      "title": "Kibana",
      "type": "link",
      "url": "https://127.0.0.1:5601"
    }
  ],
  "refresh": "30s",
  "rows": [
    {
      "collapse": false,
      "height": 412,
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 17,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "80%",
          "prefix": "",
          "prefixFontSize": "200%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": true,
            "lineColor": "rgb(0, 4, 244)",
            "show": true
          },
          "tableColumn": "",
          "targets": [
            {
              "bucketAggs": [
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "$inter",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "ip.keyword",
                  "id": "1",
                  "meta": {},
                  "settings": {},
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "thresholds": "300000,500000",
          "title": "请求总数",
          "type": "singlestat",
          "valueFontSize": "100%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "total"
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 1,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "80%",
          "prefix": "",
          "prefixFontSize": "200%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": true,
            "lineColor": "rgb(0, 14, 245)",
            "show": true
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "bucketAggs": [
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "$inter",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "ip.keyword",
                  "id": "1",
                  "meta": {},
                  "settings": {},
                  "type": "cardinality"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "thresholds": "10000,100000",
          "title": "IP访问数",
          "type": "singlestat",
          "valueFontSize": "100%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "total"
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "format": "none",
          "gauge": {
            "maxValue": 1,
            "minValue": 0,
            "show": true,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 24,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "minSpan": 3,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "s",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(240, 246, 239, 0.18)",
            "full": true,
            "lineColor": "rgb(31, 120, 193)",
            "show": true
          },
          "tableColumn": "",
          "targets": [
            {
              "bucketAggs": [
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "groupBy": [
                {
                  "params": [
                    "$__interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "metrics": [
                {
                  "field": "responsetime",
                  "id": "1",
                  "meta": {},
                  "settings": {},
                  "type": "avg"
                }
              ],
              "orderByTime": "ASC",
              "policy": "default",
              "query": "domain:$domain AND  upstreamaddr:\"unix:/usr/local/php/var/run/php-fpm.sock\" and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "value"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  }
                ]
              ],
              "tags": [],
              "timeField": "@timestamp"
            }
          ],
          "thresholds": "0.5,0.8",
          "title": "$domain 所有接口平均响应时间",
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "avg"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "id": 3,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "sortDesc": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 6,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 3,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "status",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "0"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain HTTP 状态码",
          "type": "grafana-piechart-panel",
          "valueName": "total"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "id": 11,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 6,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 3,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "ip.keyword",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain IP TOP 10",
          "type": "grafana-piechart-panel",
          "valueName": "total"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "id": 30,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 3,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 3,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "geoip.city_name.keyword",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain 访问前十的城市",
          "type": "grafana-piechart-panel",
          "valueName": "total"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "id": 31,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 3,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 3,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "geoip.region_name.keyword",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain 访问前十的省份",
          "type": "grafana-piechart-panel",
          "valueName": "total"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "id": 32,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 3,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 3,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "geoip.country_name.keyword",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain 国家/地区访问占比",
          "type": "grafana-piechart-panel",
          "valueName": "total"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "id": 14,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 3,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 3,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "request_method.keyword",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain 请求方法占比",
          "type": "grafana-piechart-panel",
          "valueName": "total"
        },
        {
          "circleMaxSize": "30",
          "circleMinSize": "3",
          "colors": [
            "rgba(0, 247, 0, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(240, 4, 45, 0.97)"
          ],
          "decimals": 0,
          "esGeoPoint": "geoip.location",
          "esLocationName": "",
          "esMetric": "Count",
          "height": "600px",
          "hideEmpty": false,
          "hideZero": true,
          "id": 35,
          "initialZoom": 1,
          "links": [],
          "locationData": "geohash",
          "mapCenter": "custom",
          "mapCenterLatitude": "30",
          "mapCenterLongitude": "120",
          "maxDataPoints": 1,
          "showLegend": true,
          "span": 12,
          "stickyLabels": false,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "geoip.location",
                  "id": "3",
                  "settings": {
                    "precision": 3
                  },
                  "type": "geohash_grid"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "thresholds": "1000,10000",
          "title": "$domain Word Map",
          "transparent": true,
          "type": "grafana-worldmap-panel",
          "unitPlural": "",
          "unitSingle": "",
          "valueName": "total"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "id": 12,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 12,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 12,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "request.keyword",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain request top 10",
          "type": "grafana-piechart-panel",
          "valueName": "total"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "height": "300px",
          "id": 13,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 12,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 12,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "referer.keyword",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain referer top 10",
          "transparent": true,
          "type": "grafana-piechart-panel",
          "valueName": "total"
        },
        {
          "aliasColors": {
            "500": "#BF1B00"
          },
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "editable": true,
          "error": false,
          "fontSize": "80%",
          "format": "short",
          "id": 16,
          "interval": null,
          "legend": {
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "minSpan": 12,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 12,
          "strokeWidth": 1,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "http_user_agent.keyword",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "auto",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain user_agent top 10",
          "type": "grafana-piechart-panel",
          "valueName": "total"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": true,
      "title": "汇总",
      "titleSize": "h6"
    },
    {
      "collapse": false,
      "height": 360,
      "panels": [
        {
          "aliasColors": {},
          "bars": true,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "decimals": 0,
          "editable": true,
          "error": false,
          "fill": 0,
          "grid": {},
          "id": 2,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "rightSide": false,
            "show": true,
            "total": true,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "bucketAggs": [
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "$inter",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "$domain 请求数",
          "tooltip": {
            "msResolution": true,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        },
        {
          "aliasColors": {
            "404": "#3F2B5B",
            "499": "#890F02",
            "500": "#BF1B00"
          },
          "bars": true,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "decimals": 0,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {},
          "id": 7,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "rightSide": true,
            "show": true,
            "total": true,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "minSpan": 12,
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "bucketAggs": [
                {
                  "fake": true,
                  "field": "status",
                  "id": "3",
                  "settings": {
                    "min_doc_count": 1,
                    "order": "desc",
                    "orderBy": "_count",
                    "size": "10"
                  },
                  "type": "terms"
                },
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "$inter",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "$domain HTTP 状态码",
          "tooltip": {
            "msResolution": true,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "none",
              "label": "状态码数量",
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        },
        {
          "aliasColors": {
            "404": "#3F2B5B",
            "499": "#890F02",
            "500": "#BF1B00"
          },
          "bars": true,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "decimals": 0,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {},
          "id": 21,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "rightSide": false,
            "show": true,
            "total": true,
            "values": true
          },
          "lines": false,
          "linewidth": 2,
          "links": [],
          "minSpan": 12,
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "bucketAggs": [
                {
                  "field": "@timestamp",
                  "id": "2",
                  "settings": {
                    "interval": "$inter",
                    "min_doc_count": 0,
                    "trimEdges": 0
                  },
                  "type": "date_histogram"
                }
              ],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "type": "count"
                }
              ],
              "query": "domain:$domain AND responsetime:[$responsetime TO 100] and user_agent!='MSIE' and user_agent!='Zabbix'",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "$domain 慢响应 时间>$responsetime s",
          "tooltip": {
            "msResolution": true,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "none",
              "label": "",
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": true,
      "title": "历史趋势",
      "titleSize": "h6"
    },
    {
      "collapse": false,
      "height": 250,
      "panels": [
        {
          "columns": [
            {
              "text": "@timestamp",
              "value": "@timestamp"
            },
            {
              "text": "ip",
              "value": "ip"
            },
            {
              "text": "geoip.city_name",
              "value": "geoip.city_name"
            },
            {
              "text": "http_user_agent",
              "value": "http_user_agent"
            },
            {
              "text": "request_method",
              "value": "request_method"
            },
            {
              "text": "request",
              "value": "request"
            },
            {
              "text": "status",
              "value": "status"
            },
            {
              "text": "responsetime",
              "value": "responsetime"
            }
          ],
          "datasource": "${DS_NGINX-ACCESS-LOG}",
          "fontSize": "100%",
          "height": "500",
          "id": 33,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": true
          },
          "span": 12,
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "/@time.*/",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "bucketAggs": [],
              "dsType": "elasticsearch",
              "metrics": [
                {
                  "field": "select field",
                  "id": "1",
                  "meta": {},
                  "settings": {
                    "size": 500
                  },
                  "type": "raw_document"
                }
              ],
              "query": "domain:$domain and status:$status and user_agent!=MSIE",
              "refId": "A",
              "timeField": "@timestamp"
            }
          ],
          "title": "$domain status:$status",
          "transform": "json",
          "transparent": true,
          "type": "table"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    }
  ],
  "schemaVersion": 14,
  "style": "dark",
  "tags": [
    "nginx",
    "es",
    "logstash",
    "log"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_NGINX-ACCESS-LOG}",
        "hide": 0,
        "includeAll": false,
        "label": "域名",
        "multi": false,
        "name": "domain",
        "options": [],
        "query": "{\"find\":\"terms\",\"field\":\"domain.keyword\"}",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_NGINX-ACCESS-LOG}",
        "hide": 0,
        "includeAll": true,
        "label": "状态码",
        "multi": true,
        "name": "status",
        "options": [],
        "query": "{\"find\":\"terms\",\"field\":\"status\"}",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "tags": [],
          "text": "2",
          "value": "2"
        },
        "hide": 0,
        "includeAll": false,
        "label": "请求时间",
        "multi": false,
        "name": "responsetime",
        "options": [
          {
            "selected": false,
            "text": "1",
            "value": "1"
          },
          {
            "selected": true,
            "text": "2",
            "value": "2"
          },
          {
            "selected": false,
            "text": "3",
            "value": "3"
          },
          {
            "selected": false,
            "text": "4",
            "value": "4"
          },
          {
            "selected": false,
            "text": "5",
            "value": "5"
          },
          {
            "selected": false,
            "text": "10",
            "value": "10"
          }
        ],
        "query": "1,2,3,4,5,10",
        "type": "custom"
      },
      {
        "auto": true,
        "auto_count": 100,
        "auto_min": "10s",
        "current": {
          "text": "auto",
          "value": "$__auto_interval"
        },
        "datasource": null,
        "hide": 0,
        "includeAll": false,
        "label": "周期",
        "multi": false,
        "name": "inter",
        "options": [
          {
            "selected": true,
            "text": "auto",
            "value": "$__auto_interval"
          },
          {
            "selected": false,
            "text": "1s",
            "value": "1s"
          },
          {
            "selected": false,
            "text": "5s",
            "value": "5s"
          },
          {
            "selected": false,
            "text": "10s",
            "value": "10s"
          },
          {
            "selected": false,
            "text": "30s",
            "value": "30s"
          },
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          },
          {
            "selected": false,
            "text": "6h",
            "value": "6h"
          },
          {
            "selected": false,
            "text": "12h",
            "value": "12h"
          },
          {
            "selected": false,
            "text": "1d",
            "value": "1d"
          },
          {
            "selected": false,
            "text": "7d",
            "value": "7d"
          },
          {
            "selected": false,
            "text": "14d",
            "value": "14d"
          },
          {
            "selected": false,
            "text": "30d",
            "value": "30d"
          }
        ],
        "query": "1s,5s,10s,30s,1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
        "refresh": 2,
        "type": "interval"
      }
    ]
  },
  "time": {
    "from": "now/d",
    "to": "now/d"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "browser",
  "title": "Elasticsearch Nginx Logs",
  "version": 2
}