Grafana dashboard: Apache Logs
Description: Visualize apache logs.

Dashboard for easy visualization of apache logs, including some filters and basic stats.

{
  "__inputs": [
    {
      "name": "DS_INFLUX",
      "label": "InfluxDB",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "3.1.1"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    }
  ],
  "id": null,
  "title": "Apache Logs",
  "tags": [],
  "style": "dark",
  "timezone": "browser",
  "editable": true,
  "hideControls": false,
  "sharedCrosshair": false,
  "rows": [
    {
      "collapse": false,
      "editable": true,
      "height": "100px",
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "datasource": "${DS_INFLUX}",
          "editable": true,
          "error": false,
          "format": "short",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 5,
          "interval": null,
          "isNew": true,
          "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"
            }
          ],
          "span": 3,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [
            {
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "policy": "default",
              "query": "SELECT count(\"request\") FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/ AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "value"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  }
                ]
              ],
              "tags": []
            }
          ],
          "thresholds": "",
          "title": "Code $code responses",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "avg"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "datasource": "${DS_INFLUX}",
          "editable": true,
          "error": false,
          "format": "bytes",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 6,
          "interval": null,
          "isNew": true,
          "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"
            }
          ],
          "span": 3,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [
            {
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "policy": "default",
              "query": "SELECT mean(\"resp_bytes\") FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/ AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "value"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  }
                ]
              ],
              "tags": []
            }
          ],
          "thresholds": "",
          "title": "Response average size",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "avg"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "datasource": "${DS_INFLUX}",
          "editable": true,
          "error": false,
          "format": "bytes",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 8,
          "interval": null,
          "isNew": true,
          "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"
            }
          ],
          "span": 3,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [
            {
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "policy": "default",
              "query": "SELECT percentile(\"resp_bytes\",99) FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/ AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "value"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  }
                ]
              ],
              "tags": []
            }
          ],
          "thresholds": "",
          "title": "99 percentile size",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "avg"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "datasource": "${DS_INFLUX}",
          "editable": true,
          "error": false,
          "format": "bytes",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 7,
          "interval": null,
          "isNew": true,
          "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"
            }
          ],
          "span": 3,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [
            {
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "policy": "default",
              "query": "SELECT max(\"resp_bytes\") FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/ AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "value"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  }
                ]
              ],
              "tags": []
            }
          ],
          "thresholds": "",
          "title": "Max response size",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "avg"
        }
      ],
      "title": "New row"
    },
    {
      "collapse": false,
      "editable": true,
      "height": "700px",
      "panels": [
        {
          "columns": [],
          "editable": true,
          "error": false,
          "fontSize": "100%",
          "id": 4,
          "isNew": true,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": true
          },
          "span": 12,
          "styles": [
            {
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "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": [
            {
              "alias": "Request",
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "measurement": "apache_access_log",
              "policy": "default",
              "query": "SELECT \"request\" FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/ AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "request"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [
                      3
                    ],
                    "type": "bottom"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "host",
                  "operator": "=~",
                  "value": "/^$server$/"
                },
                {
                  "condition": "AND",
                  "key": "resp_code",
                  "operator": "=",
                  "value": "200"
                }
              ]
            },
            {
              "alias": "agent",
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "hide": false,
              "measurement": "apache_access_log",
              "policy": "default",
              "query": "SELECT \"agent\" FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/  AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "B",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "request"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [
                      3
                    ],
                    "type": "bottom"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "host",
                  "operator": "=",
                  "value": ""
                },
                {
                  "condition": "AND",
                  "key": "resp_code",
                  "operator": "=",
                  "value": "200"
                }
              ]
            },
            {
              "alias": "ref",
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "hide": false,
              "measurement": "apache_access_log",
              "policy": "default",
              "query": "SELECT \"referrer\" FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/  AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "D",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "request"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [
                      3
                    ],
                    "type": "bottom"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "host",
                  "operator": "=",
                  "value": ""
                },
                {
                  "condition": "AND",
                  "key": "resp_code",
                  "operator": "=",
                  "value": "200"
                }
              ]
            },
            {
              "alias": "ip",
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "hide": false,
              "measurement": "apache_access_log",
              "policy": "default",
              "query": "SELECT \"client_ip\" FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/  AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "C",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "request"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [
                      3
                    ],
                    "type": "bottom"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "host",
                  "operator": "=",
                  "value": ""
                },
                {
                  "condition": "AND",
                  "key": "resp_code",
                  "operator": "=",
                  "value": "200"
                }
              ]
            },
            {
              "alias": "bytes",
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "null"
                  ],
                  "type": "fill"
                }
              ],
              "hide": false,
              "measurement": "apache_access_log",
              "policy": "default",
              "query": "SELECT \"resp_bytes\" FROM \"apache_access_log\" WHERE \"host\" =~ /^$server$/  AND \"resp_code\" =~ /^$code$/ AND $timeFilter and \"agent\" != 'Go-http-client/1.1' and agent != 'worldping-api'",
              "rawQuery": true,
              "refId": "E",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "request"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [
                      3
                    ],
                    "type": "bottom"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "host",
                  "operator": "=",
                  "value": ""
                },
                {
                  "condition": "AND",
                  "key": "resp_code",
                  "operator": "=",
                  "value": "200"
                }
              ]
            }
          ],
          "title": "",
          "transform": "timeseries_to_columns",
          "type": "table"
        }
      ],
      "title": "New row"
    }
  ],
  "time": {
    "from": "now-6h",
    "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"
    ]
  },
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": "${DS_INFLUX}",
        "hide": 0,
        "includeAll": false,
        "label": "Server",
        "multi": false,
        "name": "server",
        "options": [],
        "query": "SHOW TAG VALUES WITH KEY = \"host\" where \"resp_code\" =~ /./",
        "refresh": 1,
        "type": "query"
      },
      {
        "current": {},
        "datasource": "${DS_INFLUX}",
        "hide": 0,
        "includeAll": true,
        "label": "Response code",
        "multi": true,
        "name": "code",
        "options": [],
        "query": "SHOW TAG VALUES WITH KEY = \"resp_code\" where host =~ /^$server$/",
        "refresh": 1,
        "type": "query"
      }
    ]
  },
  "annotations": {
    "list": []
  },
  "schemaVersion": 12,
  "version": 16,
  "links": [],
  "gnetId": 968,
  "description": "Visualize apache logs."
}