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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Yanni M. (Guest)
on 2008-12-02 20:32
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!
Merlin (Guest)
on 2008-12-04 02:20
(Received via mailing list)
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;
  }
  ...
}
Yanni M. (Guest)
on 2008-12-06 16:24
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 topic is locked and can not be replied to.