I’m hosting a forum using Vanilla (http://www.vanillaforums.org), and
its internal statistics tracking involves no small amount of GETs and
POSTs to URIs that don’t correspond to actual directories underneath the
web root. Since every active user on the forum generates lots of these
every minute, I wanted to exclude them from being logged to keep the
server logs from growing to an unreasonable size, and so I added the
following three lines to my server config to stop logging of the three
main ones:
location /plugin/imonline { access_log off; log_not_found off; }
location /dashboard/notifications/inform { access_log off; log_not_found
off; }
location /settings/analyticstick.json { access_log off; log_not_found
off; }
Prior to adding the lines, the requests to those locations would
generate an HTTP 200 response and the corresponding analytic action
(counting thread views, showing who is online, etc) would be recorded in
the forum’s database. After adding the lines, all GETs and POSTs receive
404s, like this:
–
99.41.160.47 [11/Apr/2012:17:40:16 -0500] forum.chroniclesofgeorge.com:
GET /plugin/imonline HTTP/1.1 404 334
“http://forum.chroniclesofgeorge.com/” “Mozilla/5.0 (Windows NT 6.0;
rv:11.0) Gecko/20100101 Firefox/11.0”
203.122.220.202 [11/Apr/2012:16:43:28 -0500]
forum.chroniclesofgeorge.com: POST /dashboard/notifications/inform
HTTP/1.1 404 736 “http://forum.chroniclesofgeorge.com/” “Mozilla/5.0
(Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko)
Chrome/18.0.1025.152 Safari/535.19”
98.111.0.215 [11/Apr/2012:16:43:25 -0500] forum.chroniclesofgeorge.com:
POST /settings/analyticstick.json HTTP/1.1 404 736
“http://forum.chroniclesofgeorge.com/discussions/all” “Mozilla/5.0
(Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like
Gecko) Chrome/18.0.1025.151 Safari/535.19”
–
That’s one representative entry for each. I also realized that
“access_log off” appears to not prevent POST requests being logged, so
I’ll need to read up on the logging directive to see if there’s a way to
stop that.
I have since commented out the three lines and the analytics are being
collected again, but I wanted to ask if there is a way to not log any
GETs and POSTs to a named location without also generating 404s if those
locations don’t actually exist. Is it because of the string matching
method used in the location directive? Should I have tried ~ instead?
-Lee