Advertisment

Sunday 30 March 2014

Log Rotation

Log Rotation

Maintaining log files may seem like a minor housekeeping chore, but it can be critical to your disk space. Log files that aren’t on a rotation schedule can grow to become quite large. A rogue log file that’s growing out of control can even fill your entire disk space, which could shut down a server. To prevent that from happening you need to setup log rotation for any log files that aren’t already setup, then browse the log directory (/var/log/) from time to time to make sure that there aren’t any new rogue logs that are growing.

By default, the Kloxo log files aren’t rotated, but they need to be. Mostly the logs involve email and FTP activity, which can become very large in a short amount of time with enough subscribers. To setup a rotation schedule for the Kloxo log files, use webmin. Click the Others icon at the top and then click the File Manager icon. Navigate to the following directory.

/var/log/kloxo

You should see four log files in that directory. You will need to setup a log rotation schedule for each. To do that click the System icon at the top of webmin, then click the Log File Rotation icon. Click the “Add a new log file to rotate” link at the top. Fill it out like this for the courier log file.

As is indicated above, fill-in the “Log file path” with the fully-qualified location of the file. Change the “Rotation schedule“ from weekly to daily so the mail logs don’t get too large. Also change the “Number of old logs to keep” to 7, so you’ll have at least a week of back logs. Click Save.
Do that for all four Kloxo log files. The one log that’s critical is the smtp log, since operating your own email server comes with certain responsibilities. If you get a spam abuse report you’ll need to access the smtp log to deal with it. Failure to deal with spam reports can get your mail server blacklisted. Don’t let it happen! Save at least one week of smtp logs so you can research abuse reports.

IMPORTANT: As a side note, and this is totally unrelated to log rotation, but you MUST monitor your postmaster@yourdomain.com email address if you operate an email server. That’s where abuse reports are going to be sent. If you fail to reply to abuse reports sent to your postmaster account in a timely manner then your mail server will be blacklisted. You might consider forwarding your postmaster mail to an email account that you check all the time. That can be setup on Kloxo.

Browse your /var/log/ directory, and it’s subdirectories for any other log files that might need to have rotation setup. Make sure that all logs files are on rotation.

You should return to /var/log/ from time to time to look for large log files. Pay attention to the file size column. Look for any file size reported in MB instead of KB, as they might be large. This is necessary since installing new applications will deposit new log files in /var/log/ that may not have rotation setup automatically.

No comments:

Post a Comment