damn f*ck this markup

This commit is contained in:
KPACHbIuLLIAnO4 2015-09-11 00:23:37 +03:00
parent 0c7a91b4ef
commit 6fcc3b8cf8
1 changed files with 20 additions and 5 deletions

View File

@ -6,32 +6,47 @@ Configuration.
A plugin supports per-virtualhost configuration. Config may contains one or more of this sections (example): A plugin supports per-virtualhost configuration. Config may contains one or more of this sections (example):
[[webservercodes.vhosts]] [[webservercodes.vhosts]]
host = "defaulthost" host = "defaulthost"
access_log = "/var/log/apache2/access.log" access_log = "/var/log/apache2/access.log"
regex_parsestring = `\[(?P<time>[^\]]+)\] ".*?" (?P<code>\d{3})` regex_parsestring = `\[(?P<time>[^\]]+)\] ".*?" (?P<code>\d{3})`
parse_interval = "10s" parse_interval = "10s"
- 'host' is the name of virtualhost. It's preferred to use main domain as a value. 'host' is the name of virtualhost. It's preferred to use main domain as a value.
'access_log' is the full name of log file for this virtualhost (with full path). File must exists ann be readable by telegraf process owner (usually user 'telegraf').
- 'access_log' is the full name of log file for this virtualhost (with full path). File must exists ann be readable by telegraf process owner (usually user 'telegraf').
If you have apache web server installed on Debian/Ubuntu, you can set file readable by executing shell command: If you have apache web server installed on Debian/Ubuntu, you can set file readable by executing shell command:
$ sudo adduser telegraf adm
- 'regex_parsestring' is regexp pattern for log parsing. Regexp syntax must conform to goland acceptable syntax (see https://golang.org/s/re2syntax). `$ sudo adduser telegraf adm`
'regex_parsestring' is regexp pattern for log parsing. Regexp syntax must conform to goland acceptable syntax (see https://golang.org/s/re2syntax).
Pattern must include named substrings with labels 'time' and 'code'. Pattern must include named substrings with labels 'time' and 'code'.
Example for apache "common" and "combined" log formats, nginx default log format ("combined"): Example for apache "common" and "combined" log formats, nginx default log format ("combined"):
`\[(?P<time>[^\]]+)\] ".*?" (?P<code>\d{3})` `\[(?P<time>[^\]]+)\] ".*?" (?P<code>\d{3})`
This pattern matches for log entries like (example): This pattern matches for log entries like (example):
`127.0.0.1 - - [30/Aug/2015:05:59:36 +0000] "GET / HTTP/1.1" 404 379 "-" "-"` `127.0.0.1 - - [30/Aug/2015:05:59:36 +0000] "GET / HTTP/1.1" 404 379 "-" "-"`
If you use another web server, please note that time must conform to apache2 `%t` format, see default configuration and http://httpd.apache.org/docs/2.2/mod/mod_log_config.html If you use another web server, please note that time must conform to apache2 `%t` format, see default configuration and http://httpd.apache.org/docs/2.2/mod/mod_log_config.html
- 'parse_interval' is interval that limits amount of log entries readed and parsed by plugin. It allows to examine even extremely large log files. 'parse_interval' is interval that limits amount of log entries readed and parsed by plugin. It allows to examine even extremely large log files.
Usually this setting may match to global 'interval' parameter, but it can be adjusted in some cases of too high or too low load. Usually this setting may match to global 'interval' parameter, but it can be adjusted in some cases of too high or too low load.
Parameter must be in time.Duration format (see https://golang.org/pkg/time/#ParseDuration). Parameter must be in time.Duration format (see https://golang.org/pkg/time/#ParseDuration).
Collected measurements. Collected measurements.
Plugin adds tag 'virtualhost' to standard 'host' tag to all it's output values. Plugin adds tag 'virtualhost' to standard 'host' tag to all it's output values.
Output values are: Output values are:
- 'webservercodes_NNN' = (int), where NNN is all http codes defined in https://www.ietf.org/rfc/rfc2616.txt; - 'webservercodes_NNN' = (int), where NNN is all http codes defined in https://www.ietf.org/rfc/rfc2616.txt;
- 'webservercodes_total' = (int) - total amount of codes collected per one plugin start. - 'webservercodes_total' = (int) - total amount of codes collected per one plugin start.