Skip to content

Optimizing Magento log settings

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.

  • Prevents database bloat from excessive logs.
  • Improves query speed and overall site performance.
  • Reduces server resource usage.
  1. Log in to Magento with your administrator account.

  2. On the top menu bar, click System → Configuration.

  3. In the left panel, scroll down and click Advanced → System.

  4. Click Log Cleaning.

  5. 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.
  6. Optional: Configure error email notifications for log cleanup issues.

  7. Click Save Config.

✅ Magento will now automatically clean logs based on your settings.

Magento also includes a PHP script to manually clean logs:

  1. Log in via SSH.

  2. Navigate to the shell directory in your Magento installation:

    Terminal window
    cd ~/public_html/shell

    (Adjust path if Magento is installed in a subdirectory.)

  3. View log table sizes:

    Terminal window
    php -f log.php status
  4. Clean log tables, keeping only recent entries:

    Terminal window
    php -f log.php clean --days X

    (Replace X with the number of days to retain, e.g., 10.)

  • 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.