Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Does nginx have an option to ignore health checks or buckets from load balancer against nodes? There are thousands of entries like

93.190.2.176 - - [24/Jul/2012:08:56:59 +0200] "-" 400 0 "-" "-"

in my access.log which are useless to me.

Thanks for a tip

share|improve this question

3 Answers 3

server {
    listen 80 default_server;
    server_name _;
    access_log  off;
}
share|improve this answer
    
doesn't this turn off all the logs?! –  ledy Jul 24 '12 at 9:33
    
If you have another server sections with relevant server_name, then it turns off only for requests those don't reach one. Did you read the first link above? –  VBart Jul 24 '12 at 9:37
    
Note, that you can also have server section with server_name ''; and server_name *; –  VBart Jul 24 '12 at 9:38
    
yes, but i can not see if the ip or which server_name ist called. the log does not tell me. btw. i do not have a index file on this server, it's a blank page and only the health check is calling / –  ledy Jul 24 '12 at 9:42
    
Again. Do you read the docs? default_server means that this server section will be chosen by default even if no data were sent. –  VBart Jul 24 '12 at 9:46

You can turn off access_log in your global server config file and turn it on only in selected locations.

share|improve this answer
    
No, the log is fine. However, the empty entries are useless. No chance to filter and leave them? –  ledy Jul 24 '12 at 7:17

If you can configure your health check to pull a particular url then you can turn off access logging for it specifically

location = /health.php {

 access_log     off;
 ...
}
share|improve this answer
    
That's probably a TCP, not HTTP, healthcheck (hence the 400 status code), and so there's no URL to match unfortunately. –  mgorven Jul 24 '12 at 7:20
    
@mgorven: That's why I said if ... some LBs let you set a http health check. –  Iain Jul 24 '12 at 7:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.