Anonymize IP logging in nginx?

前端 未结 4 1070
臣服心动
臣服心动 2020-12-24 06:19

To respect the privacy of my users I\'m trying to anonymize their IP addresses in nginx log files.

One way to do this would be defining a custom log format, like so:<

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-24 07:08

    Here's an nginx module that basically does this (anonymizing IP addresses in your logs): ​https://github.com/masonicboom/ipscrub. It generates a hash of the IP address as $remote_addr_ipscrub. The hash salt cycles every so often (configurable), so you can link requests without logging user IP addresses.

提交回复
热议问题