How can I stop nginx logging Amazon Route 53 Health Check requests?

Question:

At the moment my AWS health check is hitting my server pretty relentlessly:

And I’d like to configure NginX to not log any requests with a user agent of "Amazon Route 53 Health Check Service".

My current attempt looks as follows:

This looks good to me, and in fact when I CURL the same address that the health check is set up to hit:

I get what I’d expect:

And my request doesn’t end up in the logs.

However, my logs continue to be swamped by these requests when they come from the actual AWS health check.

Any ideas on where I’m doing wrong?

Thanks

Answer:

So it turns out that my health check was set up to hit example.com rather than the ip address: my bad.

For the record, I discovered this by adding the $host variable to my log formats (see end of line):

Cheers anyway

Leave a Reply