How to not log Pingdom bots

zsero nginx-forum at nginx.us
Wed Aug 7 21:28:42 UTC 2013


Hi,

I'm trying to do the following:
I would like to stop logging from Pingdom bots, as a checking every 5 second
pollutes the access log and it doesn't have any meaningful value. My problem
is that I cannot integrate it into any kind of location block.

I encountered the following errors:
1. map cannot be used here
2. if cannot be used here
3. if needs to return something, while I don't want to modify what to return
except I simply want to stop logging.

Here is how I tried:
A sample server conf:

server {
	listen 80;
	server_name www.z-e-r-o.in;
	rewrite ^/(.*) http://z-e-r-o.in/$1 permanent;
}
server {
	listen 80;
	server_name z-e-r-o.in zsoltero.com;
	root /home/zsero/http/hosts/z-e-r-o.in;
	error_log /home/zsero/http/logs/z-e-r-o.in.error.log;
	access_log /home/zsero/http/logs/z-e-r-o.in.access.log;
	index index.html index.php;

	location / {
		try_files $uri $uri/ /index.php?$args;
	}

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/php.d/zsero.conf;

	client_max_body_size 200M;
}

And in /etc/nginx/conf.d/*.conf there are 5 standard configurations, one of
them being nolog.conf:

location = /robots.txt {
	access_log off;
	log_not_found off;
}

location = /favicon.ico {
	access_log off;
	log_not_found off;
}

location ^~ /apple-touch-icon {
	access_log off;
	log_not_found off;
} 

I tried methods from here:
http://www.kutukupret.com/2011/06/01/nginx-blocking-spoofed-google-bot/
http://serverfault.com/questions/414027/how-to-block-nginx-access-log-statements-from-specific-user-agents
http://fralef.me/nginx-hardening-some-good-security-practices.html

But none of them work. One reason is that they are all about returning
something, which I do _not_ want to modify, since then Pingdom would stop
working. The other reason is that I don't know where to put the map block,
since map cannot be used there is shown. 

Can you tell me how to integrate non-logging of Pingdom bot into my conf?
Also, does the conf look OK?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,241690,241690#msg-241690



More information about the nginx mailing list