Magento Database Log Cleaning

Magento is a software that keeps a huge number of logs in its database and if not cleaned regularly, they can grow quite big. We have seen Magento databases with over a few gigs of logs which is huge and slows the performance of the website down, increases the resources usage, etc. We will now cover two ways of how to clean your database logs: Manual Clean up through the database and through your Magento Administrative panel.

The Magento Administrative Panel offers a very easy-to-use tool to clean your Magento logs with just a few steps:

  1. Log into your Mangeto Administrative Panel -> System -> Configurations.
  2. In the left menu under Advanced click on System.
  3. Under “Log Cleaning“, change “Enable Log Cleaning” to YES and configure the Save Log for 7 days (Or enter the number of days you wish to keep the logs).
  4. Click “Safe Config“.

 

cPanel Hosting from WebhostFace

magento_log_cleaning

Manual Cleaning via the database is done easily through the PhpMyAdmin tool in the cPanel with just a few steps also:

  1. Log into to your cPanel -> PhpMyAdmin.
  2. On the left sidebar you will see the databases you have listed and select your Magento database.
  3. Now on the right you will see all of your Magento database tables and you need to select the ones that contain your magento logs.
  4. Scroll down to the bottom of the page and you will see a drop down menu in which you need to select “Empty“.
  5. A confirmation screen will appear. Click “Yes“. This will truncate all of the selected tables.
dataflow_batch_export;
dataflow_batch_import;
log_customer;
log_quote;
log_summary;
log_summary_type;
log_url;
log_url_info;
log_visitor;
log_visitor_info;
log_visitor_online;
report_viewed_product_index;
report_compared_product_index;
report_event;
index_event;

Cleaning Magento Logs using SSH is possible and quite simple if you have SSH access to your website.

  1. Log into to your account using SSH.
  2. In your public_html/shell folder there is a file called log.php
  3. Run the following command “php -f shell/log.php clean