Welcome! Log In Create A New Profile

Advanced

Anonymize IP logging

Posted by Dieter Knopf 
Dieter Knopf
Anonymize IP logging
May 03, 2012 07:00AM
Hello,

i'm searching for an way to anonymize the ip address in the logfiles
of nginx. I already changed the ip to "127.0.0.1", but then i can't
check for unique visitors.
There is a mond_anonstats modul available for apache, the same ip hash
would be really nice for nginx.

Thanks

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Martin Loy
Re: Anonymize IP logging
May 03, 2012 08:00AM
Hello

I'm not sure if its performance wise, but you can always define your own
log format http://wiki.nginx.org/HttpLogModule#log_format with a custom
variable instead of $remote_addr which can be almost anything, try using
for example http://wiki.nginx.org/HttpLuaModule ngx.md5 or any lua code ;)

Regards

M


On Thu, May 3, 2012 at 1:55 AM, Dieter Knopf <[email protected]>wrote:

> Hello,
>
> i'm searching for an way to anonymize the ip address in the logfiles
> of nginx. I already changed the ip to "127.0.0.1", but then i can't
> check for unique visitors.
> There is a mond_anonstats modul available for apache, the same ip hash
> would be really nice for nginx.
>
> Thanks
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



--
*Nunca hubo un amigo que hiciese un favor a un enano, ni un enemigo que le
hiciese un mal, que no se viese recompensado por entero.*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Alexandr Gomoliako
Re: Anonymize IP logging
May 03, 2012 01:00PM
> I'm not sure if its performance wise, but you can always define your own
> log format http://wiki.nginx.org/HttpLogModule#log_format with a custom
> variable instead of $remote_addr which can be almost anything, try using
> for example http://wiki.nginx.org/HttpLuaModule ngx.md5 or any lua code ;)

Or perl code, which is even easier, than lua :)

perl_set $anon_addr ' sub {
use Digest::MD5 qw(md5_hex);
my $r = shift;
md5_hex $r->remote_addr
} ';

>> i'm searching for an way to anonymize the ip address in the logfiles

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Dieter Knopf
Re: Anonymize IP logging
May 04, 2012 06:40AM
2012/5/3 Alexandr Gomoliako <[email protected]>:

> Or perl code, which is even easier, than lua :)
>
>    perl_set  $anon_addr  ' sub {
>        use Digest::MD5 qw(md5_hex);
>        my $r = shift;
>        md5_hex $r->remote_addr
>    } ';

Thanks for the info. Is there a way to configure this globally for all vhosts?

I have already this lines in my nginx.conf:
log_format combined_noip '127.0.0.1 - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';


So i would need the $anon_addr instead of the 127.0.0.1.

Thanks

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
masonicboom
Re: Anonymize IP logging
April 01, 2018 01:10AM
I made a module called ipscrub that does this: http://www.ipscrub.org. It
hashes the IP address with an ephemeral salt, so that you can match up
requests from the same IP (using the hash), but each time the salt cycles,
it becomes impossible to match an IP address with a hash in the logs.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,226003,279264#msg-279264

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login