logging fix again

This commit is contained in:
bunkerity 2020-10-25 11:24:52 +01:00
parent 022a653ebc
commit 34a0da444f
No known key found for this signature in database
GPG Key ID: 654FFF51CEF7CC47
3 changed files with 14 additions and 3 deletions

View File

@ -52,7 +52,7 @@ SecResponseBodyLimitAction ProcessPartial
SecAuditEngine RelevantOnly
SecAuditLogRelevantStatus "^(?:5|4(?!04))"
SecAuditLogType Serial
SecAuditLog /var/log/modsec_audit.log
SecAuditLog /var/log/nginx/modsec_audit.log
# scan uploaded files with clamv
%USE_CLAMAV_UPLOAD%

View File

@ -612,14 +612,14 @@ fi
# setup logrotate
replace_in_file "/etc/logrotate.conf" "%LOGROTATE_MAXAGE%" "$LOGROTATE_MAXAGE"
replace_in_file "/etc/logrotate.conf" "%LOGROTATE_MINSIZE%" "$LOGROTATE_MINSIZE"
echo "0 0 * * * logrotate -f /etc/logrotate.conf > /dev/null 2>&1 && pkill -HUP rsyslogd && fail2ban-client restart && nginx -s reload" >> /etc/crontabs/root
echo "0 0 * * * /opt/scripts/logrotate.sh > /dev/null 2>&1" >> /etc/crontabs/root
# display logs
LOGS="/var/log/access.log /var/log/error.log"
if [ "$USE_FAIL2BAN" = "yes" ] ; then
LOGS="$LOGS /var/log/fail2ban.log"
fi
tail -f $LOGS &
tail -F $LOGS &
wait $!
# sigterm trapped

11
scripts/logrotate.conf Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
logrotate -f /etc/logrotate.conf > /dev/null 2>&1
pkill -HUP rsyslogd
fail2ban-client flushlogs
if [ -f /tmp/nginx.pid ] ; then
/usr/sbin/nginx -s reload
fi