first try

This commit is contained in:
2018-11-16 10:16:09 +01:00
parent ce86ce31ed
commit 1fbbc8c3b2
2 changed files with 112 additions and 0 deletions

17
etc-cron.daily-anonymize-pafal Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# simple cronjob to anonymize IPv4 and IPv6 addresses
# in pafakedaccesslog logfile entries
# on a Debian GNU/Linux default Apache2 and PHP installation
# placed in /etc/cron.daily/ .
# config
readonly LOG="/var/www/html/pafal/faccess.log"
# ipv4
/bin/sed -i -E 's/^([[:digit:]]{1,3}\.)([[:digit:]]{1,3}\.)([^ ]*)(.*)/\1\20.0\4/' "${LOG}"
# ipv6
/bin/sed -i -E 's/^([[:xdigit:]]{1,4}:)([[:xdigit:]]{1,4}:)([[:xdigit:]]{1,4}:)([^ ]*)(.*)/\1\2\3:0\5/' "${LOG}"
exit 0