help centre
For more info visit status.atmail.com

How can we help?


Search our knowledge base for answers to
common questions and latest updates.



My activities New request

Follow

Logrotate for Atmail 6 and 7 logs

Stewart -

PROBLEM
My Atmail logs are growing too large.

ENVIRONMENT

  • On-Premise Server + WebMail Installations: Version 6.0 > Current Version
  • Webmail Only Installations: Version 6.0 > Current Version

CAUSE

Configuring Logrotate is critical, so as to reduce the size of the files used by Atmail in the webmail/log directory. To implement logrotate for your server, please do the following:

RESOLUTION

  1. Create a file in /etc/logrotate.d/ called 'logrotate_atmail_log'
  2. In the file, put:
    /usr/local/atmail/webmail/log/*log {
        weekly
    rotate 5
    missingok
        notifempty
        sharedscripts
        postrotate
    /etc/init.d/atmailserver restart >/dev/null 2>&1 || true
        endscript
    }
  3. Start logrotate:
    /usr/sbin/logrotate /etc/logrotate.conf
  4. This will then manually execute the log rotation process.


The above logrotate options cause the following:

weekly

Log files are rotated if the current weekday is less then the weekday of the last rotation or if more then a week has passed since the last rotation.

rotate 5


Remove log file after 5 rotations.

missingok


Don't error if there is a missing log file.

notifempty


If there is nothing in the log file, don't rotate.

sharedscripts


Run the following script once, instead of once for each log file.

postrotate


Run the following script after log files have been rotated.

/etc/init.d/atmailserver restart >/dev/null 2>&1 || true


Restart atmail services.

endscript


Closes off the postrotate option.

 

There are many more configuration options that may suit your installation.
This may include adding an entry for other log files (eg the atmail/mailserver/spool/log files as necessary).

Please refer to the official documentation for more information:

http://linuxcommand.org/man_pages/logrotate8.html

Have more questions? Submit a request

Comments


Contact our support team


+61 (7) 5357 6605       support@atmail.com