Log config - can I ignore requests from a certain IP?

I have a load balancer in front of nginx that performs health checks
every 2 seconds by requesting a html file from nginx. This is filling
up my access log. Can nginx be configured so that it does not log
requests from a certain IP. Thanks in advance!

This problem comes up often, and the solution is usually to turn off
access
log for that location only; something like the following is very
efficient:

server {

location = /health.html {
access_log off;
}

}

Merlin wrote:

This problem comes up often, and the solution is usually to turn off
access
log for that location only; something like the following is very
efficient:

server {

location = /health.html {
access_log off;
}

}

That does not work. I think the load balancer is doing some kind of
incomplete request to the health file on nginx. I am seeing 400 errors
in the log and no log entries for /loadcheck.html.

12.123.123.1 - - [06/Dec/2008:09:08:28 -0500] 400 “-” 0 “-” “-” “-”

I tried something like this, but not working either:

error_page  400 /400;
location = /400 {
  access_log off;
}

I also tried to put a condition when $status is 400, but nginx gave an
error that said access_log was not allowed in this block of code.

Let me know if you guys have any other ideas. Thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs