DevHeads.net

Postfix log

Dear,

I upgraded Debian from version 9 to 10 and consequently postfix 3.1.12
to 3.4.5. I'm checking log with multitail in real time and with the new
postfix version, I've a strange behavior. When the logs rotate, postfix
continues to write in the old file renamed mail.log.1 instead of the
new mail.log. I've to restart postfix to solve the problem.

I created a postfix file in logrotate.d, as the following, that worked
before the update:

/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log {
weekly
missingok
notifempty
delaycompress
compress
create 640 root adm
rotate 3650
size 10M
}

Any suggestion?

Comments

Re: Postfix log

By Matus UHLAR - f... at 08/09/2019 - 05:10

On 09.08.19 09:32, Enrico Morelli wrote:
those files are written by syslog server, and should be rotated in syslog,
not postfix logrotate config file. It's the one that causes syslog to reopen
log files when they are rotated.

RE: Postfix log

By Matthew Lowy at 08/09/2019 - 03:18

Hi Enrico,

I can't speak for why postscript behaviour has changed, but this is a known issue for other applications that hold a file open across time instead of opening it to write / closing it after write. Logrotate allows you to put in a postrotate / endscript sequence that can be used to make the application do whatever is necessary to make it re-open it's log file (or anything else...) Any lines between the line containing 'postrotate' and the line containing 'endscript' will be run after the rotate job has rotated the files. So in between you can stop / start postfix or restart postfix or any other action that can cause it to re-process it's log file.

For example...
postrotate
service postscript restart
endscript

someone else might know if postscript will handle kill -HUP (kill -1) correctly (I'm running an older version of postscript that doesn't exhibit this behaviour, it handles the log being switched under it just fine) or you could try it out.

ML

Dear,

I upgraded Debian from version 9 to 10 and consequently postfix 3.1.12 to 3.4.5. I'm checking log with multitail in real time and with the new postfix version, I've a strange behavior. When the logs rotate, postfix continues to write in the old file renamed mail.log.1 instead of the new mail.log. I've to restart postfix to solve the problem.

I created a postfix file in logrotate.d, as the following, that worked before the update:

/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log {
weekly
missingok
notifempty
delaycompress
compress
create 640 root adm
rotate 3650
size 10M
}

Any suggestion?

Re: Postfix log

By Enrico Morelli at 08/09/2019 - 03:45

On Fri, 9 Aug 2019 08:18:21 +0000

Thanks, postscript is not part of the Debian package. I'll try to put:
service postfix restart

Re: Postfix log

By Benny Pedersen at 08/09/2019 - 04:13

Enrico Morelli skrev den 2019-08-09 10:45:

this is not working, postfix send logs to syslogd, so restarting postfix
is not what to do, restart the syslogd will work

please create a bug on debian so it can be resolved, its default
logrotate problem that does not restart syslogd

Re: Postfix log

By Alexander Wirt at 08/09/2019 - 04:17

Hi,

/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
{
rotate 4
weekly
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
/usr/lib/rsyslog/rsyslog-rotate
endscript
}

cat /usr/lib/rsyslog/rsyslog-rotate
#!/bin/sh

if [ -d /run/systemd/system ]; then
systemctl kill -s HUP rsyslog.service
else
invoke-rc.d rsyslog rotate > /dev/null
fi

Re: Postfix log

By Enrico Morelli at 08/09/2019 - 04:56

On Fri, 9 Aug 2019 11:17:26 +0200

I'll try to put

postrotate
/usr/lib/rsyslog/rsyslog-rotate
endscript

in my postfix logrotate script to see if it works.

Re: Postfix log

By Matus UHLAR - f... at 08/09/2019 - 05:11

On 09.08.19 11:56, Enrico Morelli wrote:
don't. Simply look what's in /etc/logrotate.d/*syslog*
it should contain /var/log/mail. files

Re: Postfix log

By Enrico Morelli at 08/09/2019 - 05:25

On Fri, 9 Aug 2019 12:11:35 +0200

Yes, I know. But I've to maintain the log for a long time, so I created
a logrotate script that worked with the previous version of
Debian/Postfix. Now I encounter the problem described in this post.