How to set up log cleaning in Magento 1.x

Magento 1 saves your web statistics in its database. The logs inside the database could grow quite a lot in size very fast and so it is recommended to regularly clean these logs to keep Magento's database optimized.

In Magento 1 there is an option to configure an automated log cleaning that would clear up the unnecessary logs for you. You can enable it from your Magento admin panel -> System -> Configuration -> Advanced section -> System -> Log. There change the value of the Save Log, Days option. The recommended value is 15. Then set Enable Log Cleaning to Yes and save the changes.

The automated log cleaning procedure is executed via the Magento cron job, so make sure that it is configured to work properly.

Another possible way of cleaning the logs is via SSH. When you access your account via SSH, execute the following command: