Grafana dashboard: tuya FE visitor monitor
Description: nginx 日志监控


{
  "__inputs": [
    {
      "name": "DS_INFLUXDB_NGINX",
      "label": "influxdb_nginx",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    },
    {
      "name": "DS_ELASTIC_DEVELOPER",
      "label": "elastic developer",
      "description": "",
      "type": "datasource",
      "pluginId": "elasticsearch",
      "pluginName": "Elasticsearch"
    }
  ],
  "__requires": [
    {
      "type": "datasource",
      "id": "elasticsearch",
      "name": "Elasticsearch",
      "version": "5.0.0"
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.2.0-pre1"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": "5.0.0"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": "5.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "limit": 100,
        "name": "Annotations & Alerts",
        "query": "",
        "showIn": 0,
        "type": "dashboard"
      }
    ]
  },
  "description": "nginx 日志监控",
  "editable": true,
  "gnetId": 6932,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1531384256809,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 24,
      "panels": [],
      "title": "nginx 日志",
      "type": "row"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_INFLUXDB_NGINX}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 19,
      "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": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "alias": "请求数量",
          "groupBy": [],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/developer.log"
            },
            {
              "condition": "OR",
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/iot.developer.log"
            }
          ]
        }
      ],
      "thresholds": "",
      "title": "请求数量",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "alert": {
        "conditions": [
          {
            "evaluator": {
              "params": [],
              "type": "no_value"
            },
            "operator": {
              "type": "and"
            },
            "query": {
              "params": [
                "C",
                "1h",
                "now"
              ]
            },
            "reducer": {
              "params": [],
              "type": "count"
            },
            "type": "query"
          },
          {
            "evaluator": {
              "params": [],
              "type": "no_value"
            },
            "operator": {
              "type": "or"
            },
            "query": {
              "params": [
                "D",
                "1h",
                "now"
              ]
            },
            "reducer": {
              "params": [],
              "type": "count"
            },
            "type": "query"
          }
        ],
        "executionErrorState": "alerting",
        "frequency": "10m",
        "handler": 1,
        "message": "开发平台 有机器 没有访问量",
        "name": "开发平台 机器访问异常",
        "noDataState": "alerting",
        "notifications": [
          {
            "id": 2
          }
        ]
      },
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB_NGINX}",
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 5
      },
      "id": 15,
      "interval": "",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "访问量",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/developer.log"
            },
            {
              "condition": "OR",
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/iot.developer.log"
            }
          ]
        },
        {
          "alias": "访问量",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": true,
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/iot.developer.log"
            },
            {
              "condition": "OR",
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/developer.log"
            }
          ]
        },
        {
          "alias": "hz_s_node_03",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "query": "SELECT count(\"ident\") FROM \"short\".\"nginx_log\" WHERE (\"host\" = 'hz_s_node_003' AND ( \"path\" = '/mnt/logs/iot.developer.log' OR \"path\" = '/mnt/logs/developer.log')) AND $timeFilter GROUP BY time($__interval) fill(null)",
          "rawQuery": true,
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "hz_s_node_003"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/developer.log"
            }
          ]
        },
        {
          "alias": "hz_s_node_04",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "query": "SELECT count(\"ident\") FROM \"short\".\"nginx_log\" WHERE (\"host\" = 'hz_s_node_004' AND ( \"path\" = '/mnt/logs/iot.developer.log' OR \"path\" = '/mnt/logs/developer.log')) AND $timeFilter GROUP BY time($__interval) fill(null)",
          "rawQuery": true,
          "refId": "D",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=",
              "value": "hz_s_node_004"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "网站访问量",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB_NGINX}",
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 5
      },
      "id": 2,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "resp_bytes"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              },
              {
                "params": [
                  "发送数据量"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              },
              {
                "params": [
                  "请求数"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=~",
              "value": "/^$code$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "发送数据",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "alert": {
        "conditions": [
          {
            "evaluator": {
              "params": [
                3
              ],
              "type": "gt"
            },
            "operator": {
              "type": "and"
            },
            "query": {
              "params": [
                "I",
                "10m",
                "now"
              ]
            },
            "reducer": {
              "params": [],
              "type": "sum"
            },
            "type": "query"
          }
        ],
        "executionErrorState": "alerting",
        "frequency": "5m",
        "handler": 1,
        "message": "开发平台 5xx状态码",
        "name": "开发平台 5xx状态码",
        "noDataState": "ok",
        "notifications": [
          {
            "id": 2
          }
        ]
      },
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB_NGINX}",
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 14
      },
      "id": 6,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "total",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=~",
              "value": "/^$code$/"
            }
          ]
        },
        {
          "alias": "200",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "200"
            }
          ]
        },
        {
          "alias": "302",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "302"
            }
          ]
        },
        {
          "alias": "304",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "D",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "304"
            }
          ]
        },
        {
          "alias": "403",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "E",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "403"
            }
          ]
        },
        {
          "alias": "404",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "F",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "404"
            }
          ]
        },
        {
          "alias": "500",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "query": "SELECT count(\"ident\") FROM \"short\".\"nginx_log\" WHERE (\"path\" =~ /^$path$/ AND \"host\" =~ /^$hostname$/ AND \"resp_code\" =~ /5[\\d]{2}/ AND \"verb\" =~ /^$method$/) AND $timeFilter GROUP BY time($__interval) fill(0)",
          "rawQuery": true,
          "refId": "G",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "500"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            }
          ]
        },
        {
          "alias": "502",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "query": "SELECT count(\"ident\") FROM \"short\".\"nginx_log\" WHERE (\"path\" =~ /^$path$/ AND \"host\" =~ /^$hostname$/ AND \"resp_code\" = '502' AND \"verb\" =~ /^$method$/) AND $timeFilter GROUP BY time($__interval) fill(0)",
          "rawQuery": true,
          "refId": "H",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "502"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            }
          ]
        },
        {
          "alias": "5xx",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "query": "SELECT count(\"ident\") FROM \"short\".\"nginx_log\" WHERE (\"path\" =~ /^$path$/ AND \"host\" =~ /^$hostname$/ AND \"resp_code\" =~ /5[\\d]{2}/ AND \"verb\" =~ /^$method$/) AND $timeFilter GROUP BY time($__interval) fill(0)",
          "rawQuery": true,
          "refId": "J",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "502"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            }
          ]
        },
        {
          "alias": "4xx",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "query": "SELECT count(\"ident\") FROM \"short\".\"nginx_log\" WHERE (\"path\" =~ /^$path$/ AND \"host\" =~ /^$hostname$/ AND \"resp_code\" =~ /4[\\d]{2}/ AND \"verb\" =~ /^$method$/) AND $timeFilter GROUP BY time($__interval) fill(0)",
          "rawQuery": true,
          "refId": "K",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "502"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            }
          ]
        },
        {
          "alias": "5xx",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "hide": true,
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "query": "SELECT count(\"ident\") FROM \"short\".\"nginx_log\" WHERE ((\"path\" = '/mnt/logs/iot.developer.log' OR \"path\" = '/mnt/logs/developer.log') AND \"resp_code\" =~ /5[\\d]{2}/) AND $timeFilter GROUP BY time($__interval) fill(0)",
          "rawQuery": true,
          "refId": "I",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/iot.developer.log"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "502"
            }
          ]
        },
        {
          "alias": "4xx",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "hide": true,
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "query": "SELECT count(\"ident\") FROM \"short\".\"nginx_log\" WHERE ((\"path\" = '/mnt/logs/iot.developer.log' OR \"path\" = '/mnt/logs/developer.log') AND \"resp_code\" =~ /4[\\d]{2}/) AND $timeFilter GROUP BY time($__interval) fill(0)",
          "rawQuery": true,
          "refId": "L",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "ident"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/iot.developer.log"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=",
              "value": "502"
            }
          ]
        }
      ],
      "thresholds": [
        {
          "colorMode": "critical",
          "fill": true,
          "line": true,
          "op": "gt",
          "value": 3
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "状态码统计",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "alert": {
        "conditions": [
          {
            "evaluator": {
              "params": [
                4
              ],
              "type": "gt"
            },
            "operator": {
              "type": "and"
            },
            "query": {
              "params": [
                "C",
                "5m",
                "now"
              ]
            },
            "reducer": {
              "params": [],
              "type": "max"
            },
            "type": "query"
          }
        ],
        "executionErrorState": "alerting",
        "frequency": "5m",
        "handler": 1,
        "message": "开发平台时间",
        "name": "开发平台处理时间",
        "noDataState": "no_data",
        "notifications": [
          {
            "id": 1
          }
        ]
      },
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB_NGINX}",
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 14
      },
      "id": 4,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "服务器处理时间",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "stream_time"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=~",
              "value": "/^$code$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            }
          ]
        },
        {
          "alias": "请求时间",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "server_time"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "host",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "path",
              "operator": "=~",
              "value": "/^$path$/"
            },
            {
              "condition": "AND",
              "key": "resp_code",
              "operator": "=~",
              "value": "/^$code$/"
            },
            {
              "condition": "AND",
              "key": "verb",
              "operator": "=~",
              "value": "/^$method$/"
            }
          ]
        },
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": true,
          "measurement": "nginx_log",
          "orderByTime": "ASC",
          "policy": "short",
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "server_time"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/developer.log"
            },
            {
              "condition": "OR",
              "key": "path",
              "operator": "=",
              "value": "/mnt/logs/iot.developer.log"
            }
          ]
        }
      ],
      "thresholds": [
        {
          "colorMode": "critical",
          "fill": true,
          "line": true,
          "op": "gt",
          "value": 4
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "服务器处理时间",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 23
      },
      "id": 26,
      "panels": [],
      "title": "业务日志",
      "type": "row"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_ELASTIC_DEVELOPER}",
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 24
      },
      "id": 21,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "release",
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "query": "tags:release",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [],
          "timeField": "@timestamp"
        },
        {
          "alias": "preRelease",
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "tags:preRelease",
          "refId": "B",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "不同环境日志量",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_ELASTIC_DEVELOPER}",
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 24
      },
      "id": 22,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "error",
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "query": "level:ERROR",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [],
          "timeField": "@timestamp"
        },
        {
          "alias": "total",
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "*",
          "refId": "B",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "不同level日志",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_ELASTIC_DEVELOPER}",
      "fill": 1,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 33
      },
      "id": 27,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "hz_s_node_004",
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "query": "host: hz_s_node_004",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [],
          "timeField": "@timestamp"
        },
        {
          "alias": "hz_s_node_003",
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "host: hz_s_node_003",
          "refId": "B",
          "timeField": "@timestamp"
        },
        {
          "alias": "total",
          "bucketAggs": [
            {
              "field": "@timestamp",
              "id": "2",
              "settings": {
                "interval": "auto",
                "min_doc_count": 0,
                "trimEdges": 0
              },
              "type": "date_histogram"
            }
          ],
          "metrics": [
            {
              "field": "select field",
              "id": "1",
              "type": "count"
            }
          ],
          "query": "*",
          "refId": "C",
          "timeField": "@timestamp"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "不同机器日志量",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "nginx",
    "域名"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_INFLUXDB_NGINX}",
        "hide": 1,
        "includeAll": true,
        "label": "主机",
        "multi": true,
        "name": "hostname",
        "options": [],
        "query": "SHOW TAG VALUES WITH KEY = host",
        "refresh": 1,
        "regex": "/hz_s_node_00[34]/",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_INFLUXDB_NGINX}",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "method",
        "options": [],
        "query": "SHOW TAG VALUES WITH KEY = verb",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "tags": [],
          "text": "All",
          "value": [
            "$__all"
          ]
        },
        "hide": 1,
        "includeAll": true,
        "label": "域名",
        "multi": true,
        "name": "path",
        "options": [
          {
            "selected": true,
            "text": "All",
            "value": "$__all"
          },
          {
            "selected": false,
            "text": "/mnt/logs/iot.developer.log",
            "value": "/mnt/logs/iot.developer.log"
          },
          {
            "selected": false,
            "text": "/mnt/logs/developer.log",
            "value": "/mnt/logs/developer.log"
          }
        ],
        "query": "/mnt/logs/iot.developer.log,/mnt/logs/developer.log",
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_INFLUXDB_NGINX}",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "code",
        "options": [],
        "query": "SHOW TAG VALUES WITH KEY = resp_code",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "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": "",
  "title": "tuya FE visitor monitor",
  "uid": "K8xRgnvik",
  "version": 26
}