Turning off access_logs for Load Balancer TCP port checks
Zev Blut
zblut at cerego.co.jp
Tue Feb 23 10:55:49 MSK 2010
Hello,
On 02/22/2010 08:59 PM, Zev Blut wrote:
> On 02/22/2010 08:44 PM, Maxim Dounin wrote:
>> Hello!
>>
>> On Mon, Feb 22, 2010 at 06:55:17PM +0900, Zev Blut wrote:
>>
>>> We have load balancers that are doing port checks on our NGINX servers.
>>> Each of these checks creates an entry in our log file like this:
>>>
>>> 10.0.0.58 - - [22/Feb/2010:18:50:21 +0900] "-" 400 0 "-" "-" 0.000
>>> "-" "-" "-" [-] - - - [-] [-]
>>>
>>> Does anyone have an idea of how I can stop logging these requests?
>>
>> The only option you have is to turn off logging for the default
>> server on the port in question (and turn it on again for
>> individual locations if desired). Try something like this:
>>
>> server {
>> listen 80 default;
>> access_log off;
>>
>> location / {
>> access_log /path/to/log;
>> ...
>> }
>> }
>>
>> Such "requests" doesn't pass normal request processing pipeline as
>> they aren't really requests and even connection to client is
>> already closed. They are logged in configuration context which
>> happens to be here - default server's one.
>
> Thanks for the suggestion. That works.
> I might try making a new server default with the access_log off just for
> it. If that does not work, I will have a lot of access_log directives.
I have tried both ways.
So far I think the best solution is make new default servers that have
access_log off;
I.e.
# Dummy entry to stop empty tcp opens in the logs
server {
listen 80 default;
access_log off;
}
server {
listen 80
server_name example.com
access_log /path/to/log;
}
This way I don't have to put access_log directives in all of my location
directives.
Is this suitable or am I missing something important?
Thanks,
Zev
More information about the nginx
mailing list