Anonymize web logs after rotating and disable explicit download logging in favor of grepping the regular web logs

This commit is contained in:
Alex Cabal 2022-03-16 13:04:52 -04:00
parent 1ea3b2f28b
commit 1e698f2389
4 changed files with 76 additions and 16 deletions

View file

@ -60,8 +60,9 @@ Define domain standardebooks.org
DocumentRoot /standardebooks.org/web/www
ErrorDocument 404 /404
ErrorLog /var/log/local/www-error.log
DirectorySlash Off
RewriteEngine on
CustomLog "|/usr/bin/rotatelogs -f -p /standardebooks.org/scripts/rotate-www-logs /var/log/local/apache/www-access.log 86400" combined
CustomLog "|/usr/bin/rotatelogs -f -p /standardebooks.org/web/scripts/rotate-www-logs /var/log/local/apache/www-access.log 86400" combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/${domain}/fullchain.pem
@ -69,13 +70,6 @@ Define domain standardebooks.org
Header always set Strict-Transport-Security "max-age=15768000"
Header set Content-Security-Policy "default-src 'self';"
# Log downloads
SetEnvIf Request_URI "\.epub$" logdownload
SetEnvIf Request_URI "\.kepub.epub$" logdownload
SetEnvIf Request_URI "\.azw3$" logdownload
CustomLog /var/log/local/downloads.log "%h [%{%Y-%m-%d %H:%M:%S %Z}t] \"%r\" %>s %b" env=logdownload
DirectorySlash Off
<Directory /standardebooks.org/web/www/>
# Disable .htaccess files
AllowOverride none

View file

@ -60,6 +60,7 @@ Define domain standardebooks.test
DocumentRoot /standardebooks.org/web/www
ErrorDocument 404 /404
ErrorLog /var/log/local/www-error.log
DirectorySlash Off
RewriteEngine on
SSLEngine on
@ -68,13 +69,6 @@ Define domain standardebooks.test
Header always set Strict-Transport-Security "max-age=15768000"
Header set Content-Security-Policy "default-src 'self';"
# Log downloads
SetEnvIf Request_URI "\.epub$" logdownload
SetEnvIf Request_URI "\.kepub.epub$" logdownload
SetEnvIf Request_URI "\.azw3$" logdownload
CustomLog /var/log/local/downloads.log "%h [%{%Y-%m-%d %H:%M:%S %Z}t] \"%r\" %>s %b" env=logdownload
DirectorySlash Off
<Directory /standardebooks.org/web/www/>
# Disable .htaccess files
AllowOverride none