Skip to content

Instantly share code, notes, and snippets.

@dg01d
Created May 20, 2018 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dg01d/68c467685fddb9c1d0c3c56ce9ba5e04 to your computer and use it in GitHub Desktop.
Save dg01d/68c467685fddb9c1d0c3c56ce9ba5e04 to your computer and use it in GitHub Desktop.
Anonymised Nginx Logs
map $remote_addr $anon_remote_addr {
"~^(?<ip_a>\d+\.\d+)\.\d+\.\d+" "$ip_a";
}
log_format anonymised '$anon_remote_addr.0.0 - $remote_user [$time_local] '
'"$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