I am using nginx-plus (the version you have to pay for) and I would like to monitor acces by vhost.
When I used nginx free version, I could easily monitor accesses with the byprojects munin plugin:
I migrated to nginx plus and I have no data. When I log vith netcat to munin node :
$ nc localhost 4949
# munin node at servername.com
fetch byprojects_access
controlcenter.value 0
static.value 0
ccapi.value 0
tracking.value 0
reco.value 0
The main difference is I am logging via syslog when I was logging to file. Each vhost logs with a tag, here the tag nginxreco
:
access_log syslog:server=localhost,facility=local7,tag=nginxreco,severity=info;
Where I had the following log to file configuration under free nginx:
access_log /var/log/nginx/reco-access.log;
So, for the reco
vhost for instance, I had to adapt plugin configuration from :
'reco' => [
{'path' => '/var/log/nginx/reco-access.log'}
],
to
'reco' => [
{'path' => '/var/log/local7.log', 'regex' => 'nginxreco'}
],
Since I use syslog, log format changed a little bit: it adds a date, a hostname and a tag (which is the syslog way to log)
Old format (from direct file):
xx.xx.xx.xx - - [18/Mar/2014:06:25:20 +0100] "GET /HTTP/1.1" 200 52 "-" "Python-urllib/2.7"
New format (from syslog):
Mar 18 06:25:20 myhostname nginxreco: xx.xx.xx.xx - - [18/Mar/2014:06:25:20 +0100] "GET /HTTP/1.1" 200 52 "-" "Python-urllib/2.7"
What am I doing wrong ?