Skip to content

Instantly share code, notes, and snippets.

@xopez
Created May 20, 2021 18:17
Show Gist options
  • Save xopez/8ab32ec91faad1f3ee2be37a384b7d55 to your computer and use it in GitHub Desktop.
Save xopez/8ab32ec91faad1f3ee2be37a384b7d55 to your computer and use it in GitHub Desktop.
nginx snippet for anonymized log
map $remote_addr $remote_addr_anon {
~(?P<ip>\d+\.\d+\.\d+)\. $ip.0;
~(?P<ip>[^:]+:[^:]+): $ip::;
default 0.0.0.0;
}
log_format combined_ssl '$remote_addr_anon - $remote_user [$time_local] '
'$ssl_protocol/$ssl_cipher '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment