Grafana dashboard: Nginx-log-collector-Clickhouse
Description: Show metric from nginx using nginx-log-collector and store Clickhouse.


{
  "__inputs": [
    {
      "name": "DS_CLICKHOUSE-NGINX-LOG-COLLECTOR",
      "label": "clickhouse-nginx-log-collector",
      "description": "Change to you Clickhouse datasource",
      "type": "datasource",
      "pluginId": "vertamedia-clickhouse-datasource",
      "pluginName": "ClickHouse"
    },
    {
      "name": "VAR_TABLE",
      "type": "constant",
      "label": "table",
      "value": "nginx.access_log",
      "description": ""
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.5.3"
    },
    {
      "type": "panel",
      "id": "grafana-piechart-panel",
      "name": "Pie Chart",
      "version": "1.3.9"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "vertamedia-clickhouse-datasource",
      "name": "ClickHouse",
      "version": "1.9.5"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 12137,
  "graphTooltip": 1,
  "id": null,
  "iteration": 1587553662998,
  "links": [],
  "panels": [
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 7,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "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,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "15s",
          "intervalFactor": 1,
          "periods": 7,
          "query": "SELECT\n    1 as t,\n    count(*) as c\nFROM $table\nWHERE\n    $timeFilter\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri'\n    AND request_method LIKE '$substring_in_request_method'\n    AND request_time > $var_request_time\nGROUP BY t",
          "queryType": "TimeShift",
          "rawQuery": false,
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "Total Requests",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 4,
        "y": 0
      },
      "id": 8,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "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,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "15s",
          "intervalFactor": 1,
          "periods": 7,
          "query": "SELECT\n    1 as t,\n    count(*) as c\nFROM $table\nWHERE\n    $timeFilter\n    AND status NOT IN (200,201,204)\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri'\n    AND request_method LIKE '$substring_in_request_method'\n    AND request_time > $var_request_time\nGROUP BY t",
          "queryType": "TimeShift",
          "rawQuery": false,
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": "10,20,50",
      "timeFrom": null,
      "timeShift": null,
      "title": "Failed Requests with 3xx,4xx,5xx",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "decimals": 4,
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 8,
        "y": 0
      },
      "id": 9,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "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,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "periods": 7,
          "query": "SELECT\n    1 as t,\n    (sum(status = 400 or status = 401 or status = 404 or status = 405 or status = 406 or status = 407 or status = 408 or status = 415 or status = 401 or status = 422 or status = 500 or status = 502) / sum(status = 200 or status = 201 or status = 204 or status = 302 or status = 304)) * 100\nFROM $table\nWHERE\n    $timeFilter\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri'\n    AND request_time > $var_request_time\nGROUP BY t",
          "queryType": "TimeShift",
          "rawQuery": "SELECT t, groupArray((status, c)) AS groupArr FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, status, count(*) as c FROM nginx.access_log WHERE event_date >= toDate(1587540120) AND event_datetime >= toDateTime(1587540120) AND     event_date >= toDate(1587540120) AND event_datetime >= toDateTime(1587540120)     AND status IN (200,201,204,302,304,400,401,404,405,406,407,408,415,422,500,502)     AND server_name = 'upsource.tools.russianpost.ru'     AND request_uri LIKE '%%'      AND request_method LIKE '%%'      AND request_time > 0 GROUP BY t, status ORDER BY t, status) GROUP BY t ORDER BY t",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": "1,5",
      "timeFrom": null,
      "timeShift": null,
      "title": "Failing % Requests with with 3xx,4xx,5xx",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorValue": false,
      "colors": [
        "#d44a3a",
        "rgba(237, 129, 40, 0.89)",
        "#299c46"
      ],
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "decimals": 3,
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 12,
        "y": 0
      },
      "id": 20,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "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,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "periods": 7,
          "query": "SELECT\n    1 as t,\n    (((count(*) as c)) -(sum(status = 500 or status = 502 or status = 503))) /(count(*) as c) * 100\nFROM $table\nWHERE\n    $timeFilter\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method'\n    AND request_time > $var_request_time\nGROUP BY t",
          "queryType": "TimeShift",
          "rawQuery": false,
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": "98,99,100",
      "timeFrom": null,
      "timeShift": null,
      "title": "SLO",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 16,
        "y": 0
      },
      "id": 11,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "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,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "15s",
          "intervalFactor": 1,
          "periods": 7,
          "query": "SELECT\n    1 as t,\n    max(request_time) as c\nFROM $table\nWHERE\n    $timeFilter\n    AND status IN ($multiple_choice_in_status)\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY t",
          "queryType": "TimeShift",
          "rawQuery": false,
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "Max Response Time",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 20,
        "y": 0
      },
      "id": 10,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "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,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "15s",
          "intervalFactor": 1,
          "periods": 7,
          "query": "SELECT\n    1,\n    avg(request_time)\nFROM $table\nWHERE\n    $timeFilter\n    AND status IN ($multiple_choice_in_status)\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY 1",
          "queryType": "TimeShift",
          "rawQuery": "SELECT t, upstream_response_time/runningDifference(t/1000) upstream_response_timeRate FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, avg(arrayElement(upstream_response_time, 1)) as upstream_response_time FROM nginx.access_log WHERE event_date >= toDate(1582612888) AND event_datetime >= toDateTime(1582612888) AND     server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%%'     AND request_method LIKE '%%' GROUP BY t ORDER BY t)",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "Avg Response Time",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "hiddenSeries": false,
      "id": 2,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "$columns(\n    status,\n    count(*) as c)\nFROM $table\nWHERE\n    $timeFilter\n    AND status IN ($multiple_choice_in_status)\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time",
          "rawQuery": "SELECT t, groupArray((status, c)) AS groupArr FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, status, count(*) as c FROM nginx.access_log WHERE event_date >= toDate(1582614729) AND event_datetime >= toDateTime(1582614729) AND     event_date >= toDate(1582614729) AND event_datetime >= toDateTime(1582614729)     AND status IN (200,201,204,302,304,400,401,404,405,406,407,408,415,422,500,502)     AND server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%%'      AND request_method LIKE '%%'      AND request_time > 0 GROUP BY t, status ORDER BY t, status) GROUP BY t ORDER BY t",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Count Status",
      "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": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 13
      },
      "id": 22,
      "interval": null,
      "legend": {
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "options": {},
      "pieType": "pie",
      "pluginVersion": "6.5.3",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "SELECT\n    1,\n    request_uri,\n    status,\n    count(*) AS cnt\nFROM $table\nWHERE\n    $timeFilter\n    AND status NOT IN (200,201,204,302,304)\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY\n    request_uri,\n    status\nORDER BY cnt DESC\nLIMIT 5",
          "rawQuery": "SELECT t, groupArray((status, c)) AS groupArr FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, status, count(*) as c FROM nginx.access_log WHERE event_date >= toDate(1587540265) AND event_datetime >= toDateTime(1587540265) AND     event_date >= toDate(1587540265) AND event_datetime >= toDateTime(1587540265)     AND server_name = 'teamcity.tools.russianpost.ru'     AND request_uri LIKE '%%'      AND request_method LIKE '%%'      AND request_time > 0 GROUP BY t, status ORDER BY t, status) GROUP BY t ORDER BY t",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 5 failed Request_URI",
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 13
      },
      "id": 26,
      "interval": null,
      "legend": {
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "options": {},
      "pieType": "pie",
      "pluginVersion": "6.5.3",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "SELECT\n    1,\n    request_uri,\n    count(*) AS Reqs\nFROM $table\nWHERE\n    $timeFilter\n    AND status IN ($multiple_choice_in_status)\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY request_uri\nORDER BY Reqs desc\nLIMIT 15",
          "rawQuery": "SELECT t, upstream_response_time/runningDifference(t/1000) upstream_response_timeRate FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, avg(arrayElement(upstream_response_time, 1)) as upstream_response_time FROM nginx.access_log WHERE event_date >= toDate(1582620012) AND event_datetime >= toDateTime(1582620012) AND     server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%%'     AND request_method LIKE '%%'      AND request_time > 0 GROUP BY t ORDER BY t)",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 5 Request_URI",
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 23
      },
      "id": 23,
      "interval": null,
      "legend": {
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "options": {},
      "pieType": "pie",
      "pluginVersion": "6.5.3",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "SELECT\n    1,\n    IPv4NumToString(remote_addr) as remote_addr_str,\n    status,\n    count(*) AS Reqs\nFROM $table\nWHERE\n    $timeFilter\n    AND status NOT IN (200,201,204,302,304)\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY \n    remote_addr_str,\n    status\nORDER BY Reqs DESC\nLIMIT 5",
          "rawQuery": "SELECT t, good/runningDifference(t/1000) goodRate, bad/runningDifference(t/1000) badRate FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, countIf(status = 200) AS good, countIf(status != 200) AS bad FROM nginx.access_log WHERE event_date >= toDate(1587540156) AND event_datetime >= toDateTime(1587540156) AND     server_name = 'upsource.tools.russianpost.ru'     AND request_uri LIKE '%%'     AND request_method LIKE '%%'      AND request_time > 0 GROUP BY t ORDER BY t)",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 5 failed by remote_ip",
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 23
      },
      "id": 25,
      "interval": null,
      "legend": {
        "percentage": true,
        "percentageDecimals": 3,
        "show": true,
        "sideWidth": null,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "options": {},
      "pieType": "pie",
      "pluginVersion": "6.5.2",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "SELECT\n    1,\n    IPv4NumToString(remote_addr) as remote_addr_str,\n    count(*) AS Reqs\nFROM $table\nWHERE\n    $timeFilter\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY remote_addr_str\nORDER BY Reqs desc\nLIMIT 5",
          "rawQuery": false,
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 5 remote_ip",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "description": "",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 31
      },
      "id": 27,
      "interval": null,
      "legend": {
        "percentage": true,
        "percentageDecimals": 3,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "options": {},
      "pieType": "pie",
      "pluginVersion": "6.5.2",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "SELECT\n    1,\n    request_uri,\n    request_time,\n    count(*) AS cnt\nFROM $table\nWHERE\n    $timeFilter\n    AND request_time > 5\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY\n    request_uri,\n    request_time\nORDER BY cnt DESC\nLIMIT 5",
          "rawQuery": false,
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 5 request_time > 5 by Request_URI",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "description": "",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 12,
        "y": 31
      },
      "id": 28,
      "interval": null,
      "legend": {
        "percentage": true,
        "percentageDecimals": 3,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "options": {},
      "pieType": "pie",
      "pluginVersion": "6.5.2",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "SELECT\n    1,\n    IPv4NumToString(remote_addr) as remote_addr_str,\n    request_time,\n    count(*) AS Reqs\nFROM $table\nWHERE\n    $timeFilter\n    AND request_time > 5\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY\n    remote_addr_str,\n    request_time\nORDER BY Reqs DESC\nLIMIT 5",
          "rawQuery": "SELECT     1,     IPv4NumToString(remote_addr) as remote_addr_str,     request_time,     count(*) AS Reqs FROM nginx.access_log WHERE     event_date >= toDate(1582613021) AND event_datetime >= toDateTime(1582613021)     AND request_time > 5     AND server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%%'      AND request_method LIKE '%%'      AND request_time > 0.06 GROUP BY     remote_addr_str,     request_time ORDER BY Reqs DESC LIMIT 5",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 5 request_time > 5 by remote_ip",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 38
      },
      "id": 18,
      "interval": null,
      "legend": {
        "percentage": true,
        "percentageDecimals": 3,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "options": {},
      "pieType": "pie",
      "pluginVersion": "6.5.2",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "SELECT\n    1,\n    status,\n    count(*) AS Reqs\nFROM $table\nWHERE\n    $timeFilter\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY status\nORDER BY Reqs desc\nLIMIT 5",
          "rawQuery": "SELECT     1,     status,     count(*) AS Reqs FROM nginx.access_log WHERE     event_date >= toDate(1582613034) AND event_datetime >= toDateTime(1582613034)     AND server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%%'      AND request_method LIKE '%%'      AND request_time > 0.06 GROUP BY status ORDER BY Reqs desc LIMIT 5",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 5 Status Pie",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 38
      },
      "id": 17,
      "interval": null,
      "legend": {
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "options": {},
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "SELECT\n    1,\n    http_user_agent,\n    count(*) AS cnt\nFROM $table\nWHERE\n    $timeFilter\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY\n    http_user_agent\nORDER BY cnt DESC\nLIMIT 5",
          "rawQuery": false,
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Count http_user_agent",
      "type": "grafana-piechart-panel",
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 46
      },
      "hiddenSeries": false,
      "id": 14,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "15s",
          "intervalFactor": 1,
          "periods": 7,
          "query": "$rate(\n    countIf(status = 200) AS good,\n    countIf(status != 200) AS bad)\nFROM $table\nWHERE\n    server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri'\n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time",
          "queryType": "TimeShift",
          "rawQuery": "SELECT t, good/runningDifference(t/1000) goodRate, bad/runningDifference(t/1000) badRate FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, countIf(status = 200) AS good, countIf(status != 200) AS bad FROM nginx.access_log WHERE event_date >= toDate(1582613058) AND event_datetime >= toDateTime(1582613058) AND     server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%%'     AND request_method LIKE '%%'      AND request_time > 0.06 GROUP BY t ORDER BY t)",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "GoodRate/BadRate",
      "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_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 54
      },
      "hiddenSeries": false,
      "id": 13,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "periods": 7,
          "query": "$rate( avg(request_time) as request_time)\nFROM $table\nWHERE\n    server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri'\n    AND request_method LIKE '$substring_in_request_method' ",
          "queryType": "TimeShift",
          "rawQuery": "SELECT t, request_time/runningDifference(t/1000) request_timeRate FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, avg(request_time) as request_time FROM nginx.access_log WHERE event_date >= toDate(1582615964) AND event_datetime >= toDateTime(1582615964) AND     server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%api%'     AND request_method LIKE '%%' GROUP BY t ORDER BY t)",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Response Time",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "s",
          "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": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 62
      },
      "hiddenSeries": false,
      "id": 29,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": false,
        "total": false,
        "values": false
      },
      "lines": false,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "6.5.3",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "aggregation": "Last",
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "decimals": 2,
          "displayAliasType": "Warning / Critical",
          "displayType": "Regular",
          "displayValueWithAlias": "Never",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "periods": 7,
          "query": "SELECT\n    1,\n    request_time,\n    count(*) AS Reqs\nFROM $table\nWHERE\n    $timeFilter\n    AND status IN ($multiple_choice_in_status)\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time\nGROUP BY request_time\nORDER BY request_time\n",
          "queryType": "TimeShift",
          "rawQuery": false,
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days",
          "units": "none",
          "valueHandler": "Number Threshold"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Histogram Response Time > var_request_time",
      "tooltip": {
        "shared": false,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "series",
        "name": null,
        "show": true,
        "values": [
          "total"
        ]
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "s",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 70
      },
      "hiddenSeries": false,
      "id": 19,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "periods": 7,
          "query": "$rate( avg(arrayElement(upstream_response_time, 1)) as upstream_response_time)\nFROM $table\nWHERE\n    server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri'\n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time",
          "queryType": "TimeShift",
          "rawQuery": "SELECT t, upstream_response_time/runningDifference(t/1000) upstream_response_timeRate FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, avg(arrayElement(upstream_response_time, 1)) as upstream_response_time FROM nginx.access_log WHERE event_date >= toDate(1582613111) AND event_datetime >= toDateTime(1582613111) AND     server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%%'     AND request_method LIKE '%%'      AND request_time > 0 GROUP BY t ORDER BY t)",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false,
          "timeshiftUnit": "days"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Upstream response time",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "s",
          "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
      }
    },
    {
      "columns": [],
      "datasource": "${DS_CLICKHOUSE-NGINX-LOG-COLLECTOR}",
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 78
      },
      "id": 12,
      "options": {},
      "pageSize": null,
      "pluginVersion": "6.5.2",
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "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": [
        {
          "database": "nginx",
          "dateColDataType": "event_date",
          "dateLoading": false,
          "dateTimeColDataType": "event_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 1,
          "query": "$columns(\n    status,\n    count(*) as c)\nFROM $table\nWHERE\n    $timeFilter\n    AND server_name = '$vhost'\n    AND request_uri LIKE '$substring_in_request_uri' \n    AND request_method LIKE '$substring_in_request_method' \n    AND request_time > $var_request_time",
          "rawQuery": "SELECT t, upstream_response_time/runningDifference(t/1000) upstream_response_timeRate FROM ( SELECT (intDiv(toUInt32(event_datetime), 15) * 15) * 1000 AS t, avg(arrayElement(upstream_response_time, 1)) as upstream_response_time FROM nginx.access_log WHERE event_date >= toDate(1582614657) AND event_datetime >= toDateTime(1582614657) AND     server_name = 'databus.test.russianpost.ru'     AND request_uri LIKE '%%'     AND request_method LIKE '%%'      AND request_time > 0 GROUP BY t ORDER BY t)",
          "refId": "A",
          "round": "0s",
          "table": "access_log",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Count Status for all vhost",
      "transform": "timeseries_to_columns",
      "type": "table"
    }
  ],
  "refresh": "5m",
  "schemaVersion": 21,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "value": "${VAR_TABLE}",
          "text": "${VAR_TABLE}"
        },
        "hide": 2,
        "label": null,
        "name": "table",
        "options": [
          {
            "value": "${VAR_TABLE}",
            "text": "${VAR_TABLE}"
          }
        ],
        "query": "${VAR_TABLE}",
        "skipUrlSync": false,
        "type": "constant"
      },
      {
        "allValue": null,
        "current": {
          "selected": false,
          "text": "change_vhost",
          "value": "change_vhost"
        },
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "vhost",
        "options": [
          {
            "selected": true,
            "text": "change_vhost",
            "value": "change_vhost"
          }
        ],
        "query": "change_vhost",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {
          "selected": true,
          "text": "%%",
          "value": "%%"
        },
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "substring_in_request_method",
        "options": [
          {
            "selected": true,
            "text": "%%",
            "value": "%%"
          },
          {
            "selected": false,
            "text": "%GET%",
            "value": "%GET%"
          },
          {
            "selected": false,
            "text": "%POST%",
            "value": "%POST%"
          },
          {
            "selected": false,
            "text": "%PUT%",
            "value": "%PUT%"
          }
        ],
        "query": "%%,%GET%,%POST%,%PUT%,",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {
          "text": "200 + 201 + 204 + 302 + 304 + 400 + 401 + 404 + 405 + 406 + 407 + 408 + 415 + 422 + 500 + 502",
          "value": [
            "200",
            "201",
            "204",
            "302",
            "304",
            "400",
            "401",
            "404",
            "405",
            "406",
            "407",
            "408",
            "415",
            "422",
            "500",
            "502"
          ]
        },
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": true,
        "name": "multiple_choice_in_status",
        "options": [
          {
            "selected": true,
            "text": "200",
            "value": "200"
          },
          {
            "selected": true,
            "text": "201",
            "value": "201"
          },
          {
            "selected": true,
            "text": "204",
            "value": "204"
          },
          {
            "selected": true,
            "text": "302",
            "value": "302"
          },
          {
            "selected": true,
            "text": "304",
            "value": "304"
          },
          {
            "selected": true,
            "text": "400",
            "value": "400"
          },
          {
            "selected": true,
            "text": "401",
            "value": "401"
          },
          {
            "selected": true,
            "text": "404",
            "value": "404"
          },
          {
            "selected": true,
            "text": "405",
            "value": "405"
          },
          {
            "selected": true,
            "text": "406",
            "value": "406"
          },
          {
            "selected": true,
            "text": "407",
            "value": "407"
          },
          {
            "selected": true,
            "text": "408",
            "value": "408"
          },
          {
            "selected": true,
            "text": "415",
            "value": "415"
          },
          {
            "selected": true,
            "text": "422",
            "value": "422"
          },
          {
            "selected": true,
            "text": "500",
            "value": "500"
          },
          {
            "selected": true,
            "text": "502",
            "value": "502"
          }
        ],
        "query": "200,201,204,302,304,400,401,404,405,406,407,408,415,422,500,502",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {
          "selected": false,
          "text": "change_substring_in_request_uri",
          "value": "change_substring_in_request_uri"
        },
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "substring_in_request_uri",
        "options": [
          {
            "selected": true,
            "text": "change_substring_in_request_uri",
            "value": "change_substring_in_request_uri"
          }
        ],
        "query": "change_substring_in_request_uri",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {
          "selected": false,
          "text": "change_var_request_time",
          "value": "change_var_request_time"
        },
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "var_request_time",
        "options": [
          {
            "selected": true,
            "text": "change_var_request_time",
            "value": "change_var_request_time"
          }
        ],
        "query": "change_var_request_time",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-15m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Nginx-log-collector-Clickhouse",
  "uid": "K7d7JaqWk",
  "version": 2,
  "description": "Show metric from nginx using nginx-log-collector and store Clickhouse."
}