tags:

views:

21

answers:

2

I'd like to stop NGINX from logging my own IP addreess in my access.log Is this possible? I can easily do it in Apache but I haven't been able to find anything like this for NGINX.

A: 

This should really be on serverfault so I'll vote for a move.

But I can help a little here.

Short version, no you can't.

Long version. You can hack around it by using different backends for where you log one and don't log the other. Or by creating an extra server on a different port. But there isn't really a clean way of filtering an IP address from the logs.

You can however filter by url, perhaps that is an option for you?

WoLpH
Thanks for the reply WoLpH. Good to know...
Dan
A: 

You could create a virtual host that will log only your accesses, while the main log will log the rest. In this case you would access the new virtual host from your machine.

server {
  listen       80;
  server_name  domain.com www.domain.com;
  access_log   logs/domain.access.log;

Then you create a second one

server {
  listen       80;
  server_name  me.domain.com;
  access_log   logs/me.domain.access.log; 

Or remove the last line.
This way your accesses won't mix with the external accesses.

You have to add me.domain.com in DNS or in your /etc/hosts, with the same IP as the main domain.

ring0
Thats an interesting solution. Thanks for the sample code. I will give it a shot.
Dan