bokysan / docker-postfix

Multi architecture simple SMTP server (postfix null relay) host for your Docker and Kubernetes containers. Based on Debian/Ubuntu/Alpine.
MIT License
555 stars 152 forks source link

Delete duplicate logrotate config for `mail.log` #214

Closed sushain97 closed 1 month ago

sushain97 commented 2 months ago

Fixes https://github.com/bokysan/docker-postfix/issues/212. This appears to be a common strategy: https://github.com/docker-mailserver/docker-mailserver/blob/c29fe3ff0bc888016720536228878b3f19131056/Dockerfile#L259.

Before

root@postfix-mail-0:/tmp# /etc/cron.daily/logrotate
error: rsyslog:1 duplicate log entry for /var/log/mail.log
error: found error in file rsyslog, skipping
root@postfix-mail-0:/tmp# echo $?
1
root@postfix-mail-0:/tmp# cat /etc/logrotate.d/logrotate.conf
/var/log/mail.log {
    copytruncate
    rotate 1
    monthly
    minsize 1M
    compress
    missingok
    notifempty
    dateext
    olddir /var/log/
    maxage 90
}

After

root@postfix-mail-0:/tmp# if egrep -q '^/var/log/mail.log' /etc/logrotate.d/logrotate.conf; then
        echo "Removing /var/log/mail.log from /etc/logrotate.d/rsyslog"
        sed -i -E '/^\/var\/log\/mail.log/d' /etc/logrotate.d/rsyslog
fi
Removing /var/log/mail.log from /etc/logrotate.d/rsyslog
root@postfix-mail-0:/tmp# /etc/cron.daily/logrotate
root@postfix-mail-0:/tmp# echo $?
0
root@postfix-mail-0:/tmp# cat /etc/logrotate.d/rsyslog
/var/log/syslog
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/cron.log
{
        rotate 4
        weekly
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                /usr/lib/rsyslog/rsyslog-rotate
        endscript
}
bokysan commented 2 months ago

Looks good!

All tests pass? I will go over it tonight.

B

sushain97 commented 1 month ago

@bokysan gentle bump on this

bokysan commented 1 month ago

I'll merge this to master and test it out. If it works, I will push out a new version soon.

sushain97 commented 1 month ago

@bokysan thanks!

sushain97 commented 4 weeks ago

@bokysan Any word on a new version?

sushain97 commented 2 weeks ago

@bokysan just checking in - could this be released?

bokysan commented 2 weeks ago

In a couple of days. Traveling ATM.