[Dovecot] Maillog rotates, but dovecot still writes logs into old logfile?
Tere.
I use:
log_path = /var/log/maillog info_log_path = /var/log/maillog
And into /var/log are:
maillog maillog.1 maillog.2 maillog.3
Now when log files are rotating at 04:00 (maillog > maillog.1) dovecot still keeps login into maillog.1 and not into maillog, where sendmail, etc writes logs.
The only solution I did found, is adding into /etc/logrotate.d/syslog command to restart dovecot:
/var/log/maillog {
postrotate
/usr/bin/killall -HUP
syslogd
/etc/rc.d/init.d/dovecot restart >/dev/null
2>&1
endscript
}
Any other solution?
-- Mart
Mart Pirita wrote:
The only solution I did found, is adding into /etc/logrotate.d/syslog command to restart dovecot:
/etc/rc.d/init.d/dovecot restart >/dev/null 2>&1
As per the wiki, dovecot listens to SIGUSR1 to reopen a log. You want to simply use a command like:
/bin/kill -USR1 cat /var/run/dovecot/master.pid 2>/dev/null
2>
/dev/null || true
See here: http://wiki.dovecot.org/Logging#head-8886f6e09e2f691a4c45448f18f914c124dead5...
-te
-- Troy Engel | Systems Engineer Fluid, Inc | http://www.fluid.com
Quoting Mart Pirita sysadmin@e-positive.ee:
log_path = /var/log/maillog info_log_path = /var/log/maillog
Could be dangerous, unless all programs writing to /var/log/maillog use append mode (and it is on local disks, etc).
Now when log files are rotating at 04:00 (maillog > maillog.1) dovecot still keeps login into maillog.1 and not into maillog, where sendmail, etc writes logs.
Yes, sounds right.
The only solution I did found, is adding into /etc/logrotate.d/syslog command to restart dovecot:
/var/log/maillog { postrotate
/usr/bin/killall -HUP syslogd
/etc/rc.d/init.d/dovecot restart >/dev/null 2>&1 endscript
}
Any other solution?
Have dovecot log via syslog instead of to a file, and the problem goes away.
-- Mart
-- Eric Rostetter The Department of Physics The University of Texas at Austin
Go Longhorns!
Tere.
Have dovecot log via syslog instead of to a file, and the problem goes away.
Prr, how did I miss this? So, uncommenting all:
#log_path = /var/log/maillog #info_log_path = /var/log/maillog
#syslog_facility = mail
should do the trick and log all via syslog to /var/log/maillog?
-- Mart
Mart Pirita wrote:
syslog_facility = mail
should do the trick and log all via syslog to /var/log/maillog?
That's all you need on a modern Linux system, as the syslog facility 'mail' usually is sent to /var/log/maillog; this is the default for all SMTP/IMAP/POP3/etc. on any Red Hat -esque system (RHEL, Fedora, CentOS). Check your /etc/syslog.conf file.
Personally I prefer my logs discrete, and use the settings right out of the Wiki page to /var/log/dovecot.log and the included logrotate.d/ script. Works 100%.
-te
-- Troy Engel | Systems Engineer Fluid, Inc | http://www.fluid.com
participants (3)
-
Eric Rostetter
-
Mart Pirita
-
Troy Engel