Magento Basics – How To Clear Magento Log Files
Over time Magento log files build up causing your database to increase in size. This can cause issues in your site speed & can cause backup issues.
A common question that my clients ask is, how to clear Magento log files.
How To Clear Magento Log Files
There are 2 methods to clear your Magento log files:
In later versions of Magento the log files can be cleaned periodically with a Cron job. Firstly this has to be configured in your Magento backend.
System -> Configuration -> Advanced -> System -> Log Cleaning
The configuration of this is pretty straight forward.
Save Log, Days: This field sets the amount of days that your logs are stored for. I recommend 60 days.
Enable Log Cleaning: Set to yes to enable the Cron.
Start Time: This is the time that your logs will be cleared. I recommend setting this to a low traffic period as website performance may be effected slightly whilst the Cron is running.
Frequency: This is how often the Cron will check for logs that are over 60 days old.
Error Email Recipient: You should ensure this is set so you are informed of any errors or issue with the script.
Error Email Sender: This can be left as default.
Error Email Template: This can be left as default.
This method is slightly more advanced than the previous method and should only be used if you are comfortable with MySQL.
Using PHPMyAdmin run the following query on your Magento database.
This will clean all the log files that are not needed for your Magento store to function.
Conor Rhys Tomkins
Senior PHP Developer
Working with PHP applications since the age of 17. I have a wide range of knowledge on most PHP open source platforms. I must admit, my favorites are Magento & Wordpress!