Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem with Postfix and Logrotate
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
gpreston
n00b
n00b


Joined: 03 Sep 2003
Posts: 42
Location: West Chester, PA

PostPosted: Thu Jul 01, 2004 4:23 am    Post subject: Problem with Postfix and Logrotate Reply with quote

Hey everyone,

I've got Postfix 2.0.19 running on a Gentoo server, and it is logging to the default logs (/var/log/mail.err, mail.info, mail.log, and mail.warn). I've got a relatively decent amount of mail traffic going through this server and the logs tend to get rather large over time, so I set up Logrotate 3.6.5-r1 to rotate the logs for me to keep them rather small. I've added the following to my /etc/logrotate.conf file to do the job:

Code:

/var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn {
   rotate 4
   size=1M
   sharedscripts
   postrotate
      /etc/init.d/postfix stop > /dev/null
      /etc/init.d/postfix start > /dev/null
   endscript
}


Now, when this runs, for some reason Postfix continues to write to the logfile that was just backed up to a new file, for example /var/log/mail.err.1 and ignores writing to the new empty log file unless I actually reboot the entire server.

I am also using syslog-ng on this server.

Does anyone know what is causing this type of problem? Do you need to look at more logs?
Back to top
View user's profile Send private message
Rav70
l33t
l33t


Joined: 11 Feb 2004
Posts: 607
Location: Poland

PostPosted: Fri Jul 02, 2004 8:17 pm    Post subject: Re: Problem with Postfix and Logrotate Reply with quote

gpreston wrote:
Hey everyone,

Code:

/var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn {
   rotate 4
   size=1M
   sharedscripts
   postrotate
      /etc/init.d/postfix stop > /dev/null
      /etc/init.d/postfix start > /dev/null
   endscript
}


Now, when this runs, for some reason Postfix continues to write to the logfile that was just backed up to a new file, for example /var/log/mail.err.1 and ignores writing to the new empty log file unless I actually reboot the entire server.

I am also using syslog-ng on this server.

As it is not postfix but syslog-ng actually writing to the logs you have to reload syslog-ng instead of postfix, like that:
Code:

/var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn {
   rotate 4
   size=1M
   sharedscripts
   postrotate
      /etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
   endscript
}

Regards,
Rav
_________________
Q: Why is Microsoft's Product Support a failure?
A: Because Microsoft needs a Support Group instead.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum