@cryptotaxi247 / netdata-1 / commits / 71e4d0a76

add a description how to achieve vhost access logs with nginx in web_log (#5694)

Holger Segnitz committed Mar 24, 2019 at 10:53 UTC 71e4d0a764124bd80c936d1683688cc97c11dc58
1 file changed +15
collectors/python.d.plugin/web_log/web_log.conf
+15
@@ -117,6 +117,21 @@
117 # custom_log_format:
118 # 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+)'
119
120 +# in nginx: ($host or $http_host give the hostname, $server_port the port number)
121 +# log_format netdatavhost '$host $server_port $remote_addr - $remote_user [$time_local] '
122 +# '"$request" $status $body_bytes_sent '
123 +# '$request_length $request_time $upstream_response_time '
124 +# '"$http_referer" "$http_user_agent"';
125 +#
126 +# access_log /var/log/nginx/access.log netdatavhost;
127 +#
128 +# be aware that the access_log directive in a server{} block overwrites the one in http{}, if your vhosts have individual log
129 +# files, you have to specify the general netdata log in each vhost as a second access_log statement.
130 +#
131 +# and in this file in nginx_log section, add :
132 +# custom_log_format:
133 +# 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+)'
134 +
135 # ----------------------------------------------------------------------
136 # AUTO-DETECTION JOBS
137 # only one of them per web server will run (when they have the same name)