Magento’s logging feature records customer, quote, and other activity in the database. Over time, these logs can grow very large, slowing down your store. On ruachost.com, you can optimize log settings to keep your database lean and improve performance.
Why Optimize Log Settings?
-
Prevents database bloat from excessive logs.
-
Improves query speed and overall site performance.
-
Reduces server resource usage.
Optimizing Log Settings via Magento Admin
-
Log in to Magento with your administrator account.
-
On the top menu bar, click System → Configuration.
-
In the left panel, scroll down and click Advanced → System.
-
Click Log Cleaning.
-
Configure the following options:
-
Save Log Days → Recommended: 60 (or fewer for busy sites).
-
Enable Log Cleaning → Yes.
-
Start Time → Choose when Magento should clean logs.
-
Frequency → Daily.
-
-
Optional: Configure error email notifications for log cleanup issues.
-
Click Save Config.
✅ Magento will now automatically clean logs based on your settings.
Cleaning Log Tables via Command Line
Magento also includes a PHP script to manually clean logs:
-
Log in via SSH.
-
Navigate to the
shelldirectory in your Magento installation:Bash cd ~/public_html/shell(Adjust path if Magento is installed in a subdirectory.)
-
View log table sizes:
Bash php -f log.php status -
Clean log tables, keeping only recent entries:
Bash php -f log.php clean --days X(Replace
Xwith the number of days to retain, e.g., 10.)
Important Notes
-
These steps apply to Magento 1.9. Magento 2 uses a different logging system.
-
Always back up your database before cleaning logs.
-
Ensure Magento’s cron job is configured correctly for automatic log cleaning.