7 messages in ru.sysoev.nginxRe: Conditional logging
FromSent OnAttachments
Paul DlugJul 19, 2007 10:19 am 
Kiril AngovJul 19, 2007 10:59 am 
Paul DlugJul 19, 2007 11:41 am 
Ezra ZygmuntowiczJul 19, 2007 11:46 am 
Paul DlugJul 19, 2007 12:37 pm 
Igor SysoevJul 19, 2007 12:52 pm 
Igor SysoevJul 19, 2007 12:54 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Conditional loggingActions...
From:Ezra Zygmuntowicz (ezmo@public.gmane.org)
Date:Jul 19, 2007 11:46:37 am
List:ru.sysoev.nginx

On Jul 19, 2007, at 10:20 AM, Paul Dlug wrote:

Is there a way to log conditionally? For example, I have a load balancer checking a URL on nginx as a health check, there are a lot of them so I don't want them in my main log. Is there a way I can log conditionally based on IP or URL?

Paul-

You can use the geo module to not log load balancer health checks like this:

# include the load balancers we want omitted from the access log # http://wiki.codemongers.com/HWLoadbalancerCheckErrors geo $lb { default 0; 10.0.0.1/32 1; # LB IPs 10.0.0.3/32 1; }

# then inside of your server {} block use this error handler:

error_page 400 /400; location = /400 { if ($lb) { access_log off; } return 400; }

Cheers-