package webservercodes import ( "net/http" "strconv" "sync" "time" "os" "io" "regexp" "errors" "github.com/rogpeppe/rog-go/reverse" "github.com/influxdb/telegraf/plugins" ) type Vhost struct { Host string AccessLog string RegexParsestring string ParseInterval string } type Webservercodes struct { Vhosts []*Vhost } type HttpStats struct { codes map[int]int } type CombinedEntry struct { time time.Time code int } var sampleConfig = ` # List of virtualhosts for http codes collecting # (each section for one virtualhost, none for disable collecting codes) [[webservercodes.vhosts]] # 'host' field should match hostname in appropriate status url host = "defaulthost" # Telegraf user must have read permissions to this log file # (shell command 'sudo adduser telegraf adm' for apache on Ubuntu) access_log = "/var/log/apache2/access.log" # Regular expression for fetching codes from log file strings. # You can adjust this pattern for your custom log format # Example for apache "common" and "combined" log formats, nginx default log format ("combined"): # '\[(?P