Magento Log Tables - Admin Log Cleaning

Magento saves visitor and URL access information in its log tables (log_url, log_url_info, log_visitor and log_visitor_info). These tables can be quite large and affect site performance if they are not maintained. Majority of people already have some kind of traffic analysis tool - one of the most popular tools is free Google Analytics - and they don’t necessarily find Magento log tables very efficient.

You can set up a log cleaning cron job through Magento Admin panel.

  • Go to System -> Configuration.
  • Click on System from the left menu (almost at the bottom).
  • Open Log Cleaning area and change the settings as you want.

Magento Log Cleaning

A bug was reported in the version regarding this functionality. It seems fixed and the fix should be included in the next release:

Locate app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php:

$enabled = $this->getData(’groups/log/enabled/value’);
$time = $this->getData(’groups/log/fields/time/value’);
$frequncy = $this->getData(’groups/log/frequency/value’);
$errorEmail = $this->getData(’groups/log/error_email/value’);

Change the above codes from the function ‘_afterSave()’ to the following:

$enabled = $this->getData(’groups/log/fields/enabled/value’);
$time = $this->getData(’groups/log/fields/time/value’);
$frequncy = $this->getData(’groups/log/fields/frequency/value’);
$errorEmail = $this->getData(’groups/log/fields/error_email/value’);

(It’s missing “fields/” in $enabled, $frequncy, and $errorEmail.)

1 Comment

  • By zhongzhen, July 26, 2009 @ 10:37 pm

    Good blog.
    I just wanted to know this setting method.

    Please post many good blogs about magento.


Leave a comment