summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS.md1
-rw-r--r--conf.d/python.d/web_log.conf11
-rw-r--r--python.d/web_log.chart.py31
3 files changed, 42 insertions, 1 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index ea7f7876c2..7eca3f0c3e 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -111,3 +111,4 @@ username|name|email (optional)
@plasticrake|Patrick Seal
@jonfairbanks|Jon Fairbanks
@pjz|Paul Jimenez|pj@place.org
+@jgrossiord|Julien Grossiord|julien@grossiord.net
diff --git a/conf.d/python.d/web_log.conf b/conf.d/python.d/web_log.conf
index e70103cdae..a67957aeff 100644
--- a/conf.d/python.d/web_log.conf
+++ b/conf.d/python.d/web_log.conf
@@ -109,6 +109,17 @@
# CustomLog "/var/log/apache2/access.log" netdata
# ----------------------------------------------------------------------
+# VHOST AND PORT
+# if your want to graph the request/sec per virtual host and per port (to check the number of requests in http vs https)
+
+# in apache : (%v gives the hostname, %p the port number)
+# LogFormat "%v %p %h %t \"%r\" %>s %O %I %D \"%{Referer}i\" \"%{User-Agent}i\"" vhost_netdata
+#
+# and in this file in apache_vhosts_log section, add :
+# custom_log_format:
+# pattern: '(?P<vhost>[a-zA-Z\d.-_]+) (?P<port>\d+) (?P<address>[\da-f.:]+) \[.*\] "(?P<method>[A-Z]+)[^"]*" (?P<code>[1-9]\d{2}) (?P<bytes_sent>\d+) (?P<resp_length>\d+) (?P<resp_time>\d+)'
+
+# ----------------------------------------------------------------------
# AUTO-DETECTION JOBS
# only one of them per web server will run (when they have the same name)
diff --git a/python.d/web_log.chart.py b/python.d/web_log.chart.py
index f11566e952..b01ce27c2d 100644
--- a/python.d/web_log.chart.py
+++ b/python.d/web_log.chart.py
@@ -29,7 +29,7 @@ ORDER_APACHE_CACHE = ['apache_cache']
ORDER_WEB = ['response_statuses', 'response_codes', 'bandwidth',
'response_time', 'response_time_hist', 'response_time_upstream', 'response_time_upstream_hist',
- 'requests_per_url', 'requests_per_user_defined', 'http_method', 'http_version',
+ 'requests_per_url', 'requests_per_user_defined', 'http_method', 'vhost', 'port', 'http_version',
'requests_per_ipproto', 'clients', 'clients_all']
ORDER_SQUID = ['squid_response_statuses', 'squid_response_codes', 'squid_detailed_response_codes',
@@ -128,6 +128,18 @@ CHARTS_WEB = {
'web_log.requests_per_user_defined', 'stacked'],
'lines': [
['user_pattern_other', 'other', 'incremental', 1, 1]
+ ]},
+ 'port': {
+ 'options': [None, 'Requests Per Port', 'requests/s', 'port',
+ 'web_log.port', 'stacked'],
+ 'lines': [
+ ['port_80', 'http', 'incremental', 1, 1],
+ ['port_443', 'https', 'incremental', 1, 1]
+ ]},
+ 'vhost': {
+ 'options': [None, 'Requests Per Vhost', 'requests/s', 'vhost',
+ 'web_log.vhost', 'stacked'],
+ 'lines': [
]}
}
@@ -707,6 +719,23 @@ class Web:
'incremental'])
self.data[dim_id] = 0
self.data[dim_id] += 1
+ # requests per port number
+ if match_dict.get('port'):
+ if match_dict['port'] not in self.data:
+ self.charts['port'].add_dimension([match_dict['port'],
+ match_dict['port'],
+ 'incremental'])
+ self.data[match_dict['port']] = 0
+ self.data[match_dict['port']] += 1
+ # requests per vhost
+ if match_dict.get('vhost'):
+ dim_id = match_dict['vhost'].replace('.', '_')
+ if dim_id not in self.data:
+ self.charts['vhost'].add_dimension([dim_id,
+ match_dict['vhost'],
+ 'incremental'])
+ self.data[dim_id] = 0
+ self.data[dim_id] += 1
def get_data_per_response_codes_detailed(self, code):
"""