Magento log cleaning
Table of contents
What is Magento log cleaning?
Magento saves your web statistics by logging these in your database. This data is useful, but it takes up a lot of disk space and unfortunately Magento’s database is not very efficient. To keep your Magento shop optimized and thus fast, you’ll need to clean these logs. An easy way of cleaning up your database is by enabling Log Cleaning in the backend of Magento. This method is called ‘Automatic log cleaning’. More advanced Magento users can manually clean their logs.
Automatic log cleaning
Magento offers an easy tool to clean your logs. When you’re not familiar with Magento’s database system, we recommend you to use this tool. Simply follow the steps written below:
- Log into your Magento backend System -> Configurations;
- In the left menu under Advanced click on System;
- Under Log Cleaning, change Enable Log Cleaning to YES and configure the Save Log for 7 days You can change the number of days you wish to keep the logs, see screenshot below.
- Click Safe Config.
The most important setting is Save log for .. days. We recommend you to pick a number between 1 and 30 days.
How to clean your logs manually
Cleaning your Magento logs manually is the most effective way of cleaning your logs. Cleaning logs manually is not recommended if you’re not familiar with databases. You can use SSH or PHPMyAdmin to clean up.
Manual log cleaning with SSH
Log on to your SSH server, navigate to the root of your Magento shop and use the following command:
php -f shell/log.php clean
Manual log cleaning with PHPMyAdmin
Open your database in PHPMyAdmin and select the following tables:
Scroll down to select ‘Empty’ from the dropdown ‘With selected’ and click yes.
Turn off database logging
If you don’t need any database logging it can be worthwhile to disable all logging. To do so, install the disablelog extension by Yireo.
For shops that are heavy on the database, this can help reduce the amount of update/insert queries and therefore reducing load times.