Postfix log

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix log

Enrico Morelli
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?

--
-----------------------------------------------------------
  Enrico Morelli
  System Administrator | Programmer | Web Developer

  CERM - Polo Scientifico
  via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY
------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

RE: Postfix log

matthew
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

-----Original Message-----
From: [hidden email] <[hidden email]> On Behalf Of Enrico Morelli
Sent: 09 August 2019 08:33
To: [hidden email]
Subject: 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?

--
-----------------------------------------------------------
  Enrico Morelli
  System Administrator | Programmer | Web Developer

  CERM - Polo Scientifico
  via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY
------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Postfix log

Enrico Morelli
On Fri, 9 Aug 2019 08:18:21 +0000
Matthew Lowy <[hidden email]> wrote:

> 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.
>

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


> ML
>
> -----Original Message-----
> From: [hidden email]
> <[hidden email]> On Behalf Of Enrico Morelli Sent:
> 09 August 2019 08:33 To: [hidden email]
> Subject: 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?
>
> --
> -----------------------------------------------------------
>   Enrico Morelli
>   System Administrator | Programmer | Web Developer
>
>   CERM - Polo Scientifico
>   via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY
> ------------------------------------------------------------



--
-----------------------------------------------------------
  Enrico Morelli
  System Administrator | Programmer | Web Developer

  CERM - Polo Scientifico
  via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY
------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Postfix log

Benny Pedersen-2
Enrico Morelli skrev den 2019-08-09 10:45:

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

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
Reply | Threaded
Open this post in threaded view
|

Re: Postfix log

Alexander Wirt
On Fri, 09 Aug 2019, Benny Pedersen wrote:

Hi,

> > Thanks, postscript is not part of the Debian package. I'll try to put:
> > service postfix restart
>
> 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
The default syslogd (rsyslogd) in debian does that:

/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


Reply | Threaded
Open this post in threaded view
|

Re: Postfix log

Enrico Morelli
On Fri, 9 Aug 2019 11:17:26 +0200
Alexander Wirt <[hidden email]> wrote:

> On Fri, 09 Aug 2019, Benny Pedersen wrote:
>
> Hi,
>
> > > Thanks, postscript is not part of the Debian package. I'll try to
> > > put: service postfix restart  
> >
> > 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  
> The default syslogd (rsyslogd) in debian does that:
>
> /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
>
>

I'll try to put

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

in my postfix logrotate script to see if it works.

--
-----------------------------------------------------------
  Enrico Morelli
  System Administrator | Programmer | Web Developer

  CERM - Polo Scientifico
  via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY
------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Postfix log

Matus UHLAR - fantomas
In reply to this post by Enrico Morelli
On 09.08.19 09:32, Enrico Morelli wrote:

>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?

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.

--
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I wonder how much deeper the ocean would be without sponges.
Reply | Threaded
Open this post in threaded view
|

Re: Postfix log

Matus UHLAR - fantomas
In reply to this post by Enrico Morelli
On 09.08.19 11:56, Enrico Morelli wrote:
>I'll try to put
>
>   postrotate
>         /usr/lib/rsyslog/rsyslog-rotate
>   endscript
>
>in my postfix logrotate script to see if it works.

don't. Simply look what's in /etc/logrotate.d/*syslog*
it should contain /var/log/mail. files

--
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Spam is for losers who can't get business any other way.
Reply | Threaded
Open this post in threaded view
|

Re: Postfix log

Enrico Morelli
On Fri, 9 Aug 2019 12:11:35 +0200
Matus UHLAR - fantomas <[hidden email]> wrote:

> On 09.08.19 11:56, Enrico Morelli wrote:
> >I'll try to put
> >
> >   postrotate
> >         /usr/lib/rsyslog/rsyslog-rotate
> >   endscript
> >
> >in my postfix logrotate script to see if it works.  
>
> don't. Simply look what's in /etc/logrotate.d/*syslog*
> it should contain /var/log/mail. files
>

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.

--
-----------------------------------------------------------
  Enrico Morelli
  System Administrator | Programmer | Web Developer

  CERM - Polo Scientifico
  via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY
------------------------------------------------------------