Magento Forum

   
Log Cleaning
 
Mitirapa
Jr. Member
 
Total Posts:  30
Joined:  2007-08-31
 

Hi,

my tables :
log_url
log_url_info
log_visitor
log_visitor_info

have about 500 Mb in my database…

and in my admin, i have for my shop
Save log, days : 1
Enable log cleaning : Yes
Start Time 07:00:00
Frequency : Daily

and my cron job is ok (sitemap generate each day)

so, why my log tables aren’t truncate ?

can i do it myself without magento prbl ?

Thanks for your help

 
Magento Community Magento Community
Magento Community
Magento Community
 
Appmerce
Guru
 
Avatar
Total Posts:  376
Joined:  2008-05-13
Amsterdam, The Netherlands
 

The solution is here:
http://www.magentocommerce.com/bug-tracking/issue?issue=4993

It appears to be fixed in Magento 1.2.0.3

In 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 above to (adding missing “fields/” in three places):

$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');

 
Magento Community Magento Community
Magento Community
Magento Community
 
antrax13
Member
 
Total Posts:  46
Joined:  2008-08-26
 

I ckeck this in magento 1.4.0.1, the file are ok but dont work, not clean the log.

¿its posible solve this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
GFEMajor
Sr. Member
 
Total Posts:  138
Joined:  2010-01-11
 

Same Problem here with Magento 1.4.1.1.

Did you found a solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MK_dizajn
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2010-05-22
Zagreb, Croatia
 

Hi,

I created clean.php in magento root: this is content:

<?
$db['host'] = 'localhost'; // Database hostname
$db['name'] = 'name'; // Database name
$db['user'] = 'user'; // Database username
$db['pass'] = 'pass'; // Database password
$db['pref'] = ''; // Database tables' prefix

if($_GET['clean'] == 'log') clean_log_tables();
if($_GET['clean'] == 'var') clean_var_directory();
if($_GET['clean'] == 'oba') {clean_log_tables();clean_var_directory();}

function clean_log_tables() {
global $db;

$tables = array(
'log_url',
'log_url_info',
'log_visitor',
'log_visitor_info'
);

mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error());
mysql_select_db($db['name']) or die(mysql_error());

foreach($tables as $v => $k) {
mysql_query('TRUNCATE `'.$db['pref'].$k.'`') or die(mysql_error());
}
}

function clean_var_directory() {
$dirs = array(
'var/cache/',
'var/log/',
'var/report/',
'var/session/',
'var/tmp/',
'downloader/pearlib/cache/*',
'downloader/pearlib/download/*'
);

foreach($dirs as $v => $k) {
exec('rm -rf '.$k);
}
}
?>

and call it via cron like :

store_url/clean.php?clean=log
store_url/clean.php?clean=var

thats it, hope that helps you !

 
Magento Community Magento Community
Magento Community
Magento Community
 
GFEMajor
Sr. Member
 
Total Posts:  138
Joined:  2010-01-11
 

Thank you smile.

But why has magento a problem with cleaning the logs itself?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top