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.
I’m not sure if its performance wise, but you can always define your own
log format Module ngx_http_log_module with a custom
variable instead of $remote_addr which can be almost anything, try using
for example Lua | NGINX ngx.md5 or any lua code
I’m not sure if its performance wise, but you can always define your own
log format Module ngx_http_log_module with a custom
variable instead of $remote_addr which can be almost anything, try using
for example Lua | NGINX 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
} ';
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.