Nginxhouse
Nginx logs analyzer
https://github.com/nginxhouse/nginxhouse
{
  "__inputs": [
    {
      "name": "DS_CLICKHOUSE",
      "label": "clickhouse",
      "description": "",
      "type": "datasource",
      "pluginId": "vertamedia-clickhouse-datasource",
      "pluginName": "ClickHouse"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.2.0"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "vertamedia-clickhouse-datasource",
      "name": "ClickHouse",
      "version": "1.8.1"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "limit": 100,
        "name": "Annotations & Alerts",
        "showIn": 0,
        "tags": [
          "deployment"
        ],
        "type": "tags"
      }
    ]
  },
  "description": "Nginx logs analyzer",
  "editable": true,
  "gnetId": 10758,
  "graphTooltip": 1,
  "id": null,
  "iteration": 1566307473937,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 0
      },
      "id": 14,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {},
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    SUM(n) as n,\n    host\nFROM nginx.report_access_log_by_all\nWHERE\n    $timeFilter\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $host <> 'all' THEN host = $host ELSE 1 END\n    AND CASE WHEN $request_uri <> 'all' THEN request_uri = $request_uri ELSE 1 END\n    AND CASE WHEN $cache <> 0 THEN cache = $cache ELSE 1 END\nGROUP BY host, t\nORDER BY t, n desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     SUM(n) as n,     host FROM nginx.report_access_log_by_all WHERE     timestamp >= toDateTime(1566134821)     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN host = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN request_uri = 'all' ELSE 1 END     AND CASE WHEN 0 <> 0 THEN cache = 0 ELSE 1 END GROUP BY host, t ORDER BY t, n desc",
          "refId": "A",
          "round": "1m",
          "table": "nginx_report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "host",
      "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}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 0
      },
      "id": 16,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {},
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    SUM(n) as n,\n    request_uri\nFROM nginx.report_access_log_by_all\nWHERE\n    $timeFilter\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $host <> 'all' THEN host = $host ELSE 1 END\n    AND CASE WHEN $request_uri <> 'all' THEN request_uri = $request_uri ELSE 1 END\n    AND CASE WHEN $cache <> 0 THEN cache = $cache ELSE 1 END\nGROUP BY request_uri, t\nHAVING n > 10\nORDER BY t, n desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     SUM(n) as n,     request_uri FROM nginx.report_access_log_by_all WHERE     timestamp >= toDateTime(1566134821)     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN host = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN request_uri = 'all' ELSE 1 END     AND CASE WHEN 0 <> 0 THEN cache = 0 ELSE 1 END GROUP BY request_uri, t HAVING n > 10 ORDER BY t, n desc",
          "refId": "A",
          "round": "1m",
          "table": "nginx_report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "request_uri",
      "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}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 0
      },
      "id": 13,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {},
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    SUM(n) as n,\n    request_uri || ':' || toString(status) as request_uri\nFROM nginx.report_access_log_by_all\nWHERE\n    $timeFilter\n    AND status > 200\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $host <> 'all' THEN host = $host ELSE 1 END\n    AND CASE WHEN $request_uri <> 'all' THEN request_uri = $request_uri ELSE 1 END\n    AND CASE WHEN $cache <> 0 THEN cache = $cache ELSE 1 END\nGROUP BY request_uri, t\nHAVING n > 10\nORDER BY t, n desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     SUM(n) as n,     request_uri || ':' || toString(status) as request_uri FROM nginx.report_access_log_by_all WHERE     timestamp >= toDateTime(1566134821)     AND status > 200     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN host = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN request_uri = 'all' ELSE 1 END     AND CASE WHEN 0 <> 0 THEN cache = 0 ELSE 1 END GROUP BY request_uri, t HAVING n > 10 ORDER BY t, n desc",
          "refId": "A",
          "round": "1m",
          "table": "nginx_report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "status > 200",
      "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}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 8
      },
      "id": 11,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "avg",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {},
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    sum(n) as m,\n    http_user_agent\nFROM nginx.report_access_log_by_http_user_agent\nWHERE\n    $timeFilter\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $host <> 'all' THEN host = $host ELSE 1 END\n    AND CASE WHEN $request_uri <> 'all' THEN request_uri = $request_uri ELSE 1 END\nGROUP BY t, http_user_agent\nORDER BY t, m desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     sum(n) as m,     http_user_agent FROM nginx.report_access_log_by_http_user_agent WHERE     timestamp >= toDateTime(1566134821)     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN host = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN request_uri = 'all' ELSE 1 END GROUP BY t, http_user_agent ORDER BY t, m desc",
          "refId": "A",
          "round": "1m",
          "table": "nginx_report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "http_user_agent",
      "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}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 8
      },
      "id": 12,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {},
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    sum(response_time_sum) as response_time_sum,\n    request_uri\nFROM nginx.report_access_log_by_all\nWHERE\n    $timeFilter\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $host <> 'all' THEN host = $host ELSE 1 END\n    AND CASE WHEN $request_uri <> 'all' THEN request_uri = $request_uri ELSE 1 END\n    AND CASE WHEN $cache <> 0 THEN cache = $cache ELSE 1 END\n    AND n > 10\nGROUP BY request_uri, t\nORDER BY t, response_time_sum desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     sum(response_time_sum) as response_time_sum,     request_uri FROM nginx.report_access_log_by_all WHERE     timestamp >= toDateTime(1566134821)     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN host = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN request_uri = 'all' ELSE 1 END     AND CASE WHEN 0 <> 0 THEN cache = 0 ELSE 1 END     AND n > 10 GROUP BY request_uri, t ORDER BY t, response_time_sum desc",
          "refId": "A",
          "round": "1m",
          "table": "nginx_report_by_all",
          "tableLoading": false
        }
      ],
      "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": "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}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 8
      },
      "id": 15,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {},
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    SUM(body_bytes_sent_sum) as body_bytes_sent_sum,\n    request_uri\nFROM nginx.report_access_log_by_all\nWHERE\n    $timeFilter\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $host <> 'all' THEN host = $host ELSE 1 END\n    AND CASE WHEN $request_uri <> 'all' THEN request_uri = $request_uri ELSE 1 END\n    AND CASE WHEN $cache <> 0 THEN cache = $cache ELSE 1 END\n    AND n > 10\nGROUP BY request_uri, t\nORDER BY t, body_bytes_sent_sum desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     SUM(body_bytes_sent_sum) as body_bytes_sent_sum,     request_uri FROM nginx.report_access_log_by_all WHERE     timestamp >= toDateTime(1566134821)     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN host = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN request_uri = 'all' ELSE 1 END     AND CASE WHEN 0 <> 0 THEN cache = 0 ELSE 1 END     AND n > 10 GROUP BY request_uri, t ORDER BY t, body_bytes_sent_sum desc",
          "refId": "A",
          "round": "1m",
          "table": "nginx_report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "body_bytes_sent",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "decbits",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "decbits",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "columns": [],
      "datasource": "${DS_CLICKHOUSE}",
      "fontSize": "100%",
      "gridPos": {
        "h": 4,
        "w": 24,
        "x": 0,
        "y": 16
      },
      "id": 10,
      "links": [],
      "options": {},
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [],
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "table",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "WITH ($to - $from) AS seconds \nSELECT\n    request_uri\n    , response_time_max / n AS response_time_avg\n    , max(response_time_max) AS response_time_max\n    , sum(response_time_sum) AS response_time_sum\n    , sum(n) AS n\n    \nFROM nginx.report_access_log_by_all\nWHERE $timeFilter\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $host <> 'all' THEN host = $host ELSE 1 END\n    AND CASE WHEN $request_uri <> 'all' THEN request_uri = $request_uri ELSE 1 END\nGROUP BY request_uri\nORDER BY response_time_avg DESC \nLIMIT 20",
          "rawQuery": "WITH (1566307814 - 1566134956) AS seconds  SELECT     request_uri     , response_time_max / n AS response_time_avg     , max(response_time_max) AS response_time_max     , sum(response_time_sum) AS response_time_sum     , sum(n) AS n      FROM nginx.report_access_log_by_all WHERE timestamp >= toDateTime(1566134956)     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN host = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN request_uri = 'all' ELSE 1 END GROUP BY request_uri ORDER BY response_time_avg DESC  LIMIT 20",
          "refId": "A",
          "round": "15s",
          "table": "nginx_report_by_all",
          "tableLoading": false
        }
      ],
      "title": "TOP 10 slow scripts",
      "transform": "table",
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 18,
  "style": "dark",
  "tags": [
    "php",
    "performance"
  ],
  "templating": {
    "list": [
      {
        "allValue": "'all'",
        "current": {},
        "datasource": "${DS_CLICKHOUSE}",
        "definition": "SELECT DISTINCT hostname FROM nginx.report_access_log_by_all WHERE timestamp >= toStartOfDay(now())",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": false,
        "name": "hostname",
        "options": [],
        "query": "SELECT DISTINCT hostname FROM nginx.report_access_log_by_all WHERE timestamp >= toStartOfDay(now())",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": "'all'",
        "current": {},
        "datasource": "${DS_CLICKHOUSE}",
        "definition": "SELECT host FROM nginx.report_access_log_by_all WHERE timestamp >= toStartOfDay(now()) GROUP BY host ORDER BY sum(n) desc",
        "hide": 0,
        "includeAll": true,
        "label": "host",
        "multi": false,
        "name": "host",
        "options": [],
        "query": "SELECT host FROM nginx.report_access_log_by_all WHERE timestamp >= toStartOfDay(now()) GROUP BY host ORDER BY sum(n) desc",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": "'all'",
        "current": {},
        "datasource": "${DS_CLICKHOUSE}",
        "definition": "SELECT request_uri FROM nginx.report_access_log_by_all WHERE timestamp >= toStartOfDay(now()) GROUP BY request_uri ORDER BY sum(n) desc",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": false,
        "name": "request_uri",
        "options": [],
        "query": "SELECT request_uri FROM nginx.report_access_log_by_all WHERE timestamp >= toStartOfDay(now()) GROUP BY request_uri ORDER BY sum(n) desc",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "tags": [],
          "text": "0",
          "value": "0"
        },
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "cache",
        "options": [
          {
            "selected": true,
            "text": "0",
            "value": "0"
          },
          {
            "selected": false,
            "text": "1",
            "value": "1"
          },
          {
            "selected": false,
            "text": "2",
            "value": "2"
          }
        ],
        "query": "0,1,2",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-2d",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "browser",
  "title": "Nginxhouse",
  "uid": "gtE8AaWWk",
  "version": 10
}