Log rotation and combining...

Bill Shirley bill at KnoxvilleChristian.org
Fri Nov 17 03:53:56 EET 2017


I believe you need a 'create' statement to set the permissions. Here
is an example for mariadb:
/var/log/mariadb/general.log
/var/log/mariadb/slow_query.log
/var/log/mariadb/error.log
/var/log/mariadb/mariadb.log {
         create 640 mysql mysql
         daily
         minsize 30M
         notifempty
         rotate 3
         missingok
         compress
         sharedscripts
         postrotate
#       # just if mysqld is really running
                 if test -x /usr/bin/mysqladmin && \
                         /usr/bin/mysqladmin ping &>/dev/null
                 then
                         /usr/bin/mysqladmin flush-logs
                 fi
         endscript
}

Bill


On 11/16/2017 4:27 AM, SH Development wrote:
> I have recently noticed that my dovecot-deliver.log is huge and wanted to start rotating it.  So a couple of questions:
>
> 1. Can the dovecot-deliver.log be combined with the maillog, that gets rotated weekly?  If it can be done, is it advisable?
> Since the inception of this particular server, the log file has been located in the /home/vmail directory.  Is there a reason it shouldn’t be located in the /var/log directory with the maillog?
>
> 2. Separate from above, if I create a new logrotate script example as follows:
>
> # dovecot SIGUSR1: Re-opens the log files.
> /home/vmail/dovecot-deliver.log {
>    missingok
>    notifempty
>    delaycompress
>    sharedscripts
>    postrotate
>      /bin/kill -USR1 `cat /var/run/dovecot/master.pid 2>/dev/null` 2> /dev/null || true
>    endscript
> }
>
> I get the following error only when cron tries to run it:
>
> /etc/cron.daily/logrotate:
> error: stat of /home/vmail/dovecot-deliver.log failed: Permission denied
>
>
> Owner on the log are vmail:vmail.  If I manually force logrotate on this particular log, it works fine.
>
>
> Ethon



More information about the dovecot mailing list