Settting up system logging

With only 2 GB of space on our virtual dedicated server it didn't take long to realise the importance of monitoring the size of the log files. Mysql was set to log everything while we were developing our site and had quickly grown to a 700+ MB file as a result of numerours repligard imports dumps and reimports as we were bringing the data from the old website.

This was fixed by editing the /etc/mysql/my.conf file and replacing the

log = /var/log/mysql/mysql.log

line with the following line

log-bin = /var/log/mysql/mysql-bin.log

The log-bin option is the same as log-update in that it only logs changes to the database instead of all queries like the log option, but it logs them more efficiently. To read log-bin logs you need to use the mysqlbinlog command. For more information see mysqlbinlog --help

Another thing I wanted to do was to stop cron logging to syslog as the cronjob required to get the publish link in Aegir working (the nadminstudio.sh script) resulted in cron outputting a line to syslog every minute. This was done by changing the following line:

*.*;auth,authpriv.none -/var/log/syslog

to

*.*;auth,authpriv,cron.none -/var/log/syslog

See the man pages of syslog and syslog.conf for more information on how this works.
I also uncommented the following line

cron.* /var/log/cron.log

so cron would log to its own file.

Will monitor the size of the logs and if they start to look like the are taking up to much space will adjust /etc/logrotate.conf to increase the rate of rotation of the logs.