I have an apache/nginx/whatever web server which logs client IP addresses to the access logs. Now these log files are rotated via logrotate
.
I want to keep the IP addresses for some days, then after 7 days, I want to remove the IPs from the log files for privacy reasons (mostly dictated by German law).
Using mod_removeip
or something like that doesn't work because I need to filter some requests based on their IP addresses.
Is there any 'standard' way to do it? Maybe even with logrotate
?
EDIT
I just found this script but it depends on the ability to pipe all logging through the script in real-time. I'm not really sure about the performance implication of this approach.
Also, this only works for the 'front-end' server logs, not the application server logs.