Magento log maintenance
Magento keeps several database tables for logging which if not cleared regularly can start to cause problems.
There are several different ways that the database tables can be cleared and I will detail them in this post. Some of the reasons to keep the database clean are:
1. It keeps the database small which allows for easier backup
2. Logs are easier to review in the case of a problem
3. It can free up disk space
The method we normally use to clear these tables is to execute the php file locally with a command like the below:
php -f /site/document/root/shell/log.php clean
Magento comes with this file after a default install in the shell directory in the root of the site.
The second method is to initiate the clean from the magento admin interface. The option can be found under System > Configuraton and the under the log cleaning section you can enable it and specify the retention period you would like.
The final method is to manually flush the tables via the mysql command line, this method is by far the most risky and should only be undertaken if absolutely necessary. The tables to flush are listed below:
If you’re finding that your Magento DB is rather large and can’t figure out why I would recommend checking out these tables as they can creep up in size without maintenance.