Naming a virtual location to avoid logging results in 404s

BigdinoWebmaster webmaster at
Fri Apr 13 12:41:33 UTC 2012

I'm hosting a forum using Vanilla (, 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:

-- [11/Apr/2012:17:40:16 -0500] GET /plugin/imonline HTTP/1.1 404 334 "" "Mozilla/5.0 (Windows NT 6.0; rv:11.0) Gecko/20100101 Firefox/11.0" [11/Apr/2012:16:43:28 -0500] POST /dashboard/notifications/inform HTTP/1.1 404 736 "" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.152 Safari/535.19" [11/Apr/2012:16:43:25 -0500] POST /settings/analyticstick.json HTTP/1.1 404 736 "" "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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list