RaphaelDuraes
RaphaelDuraes

Reputation: 35

Magento Cleaning Log feature doesn't work

I'd like to find the problem with my Cleaning Log feature. I'm using Magento 1.7 and have magento's cron working(already checked in database - cron_schedule) by cron.sh.

The problem: my log tables are still full after I enable the Cleaning Log and I'm not seeing anything related with in the cron_schedule table!

My System > Configuration > System

CRON(SCHEDULE TASK)

Generate Schedules Every 60
Schedule Ahead for 1
Missed if Not Run Within 60
History Cleanup Every 120
Success History Lifetime 120
Failure History Lifetime 120
============================
LOG CLEANING

Save Log, Days 1
Enable Log Cleaning YES
Start Time 00:30:00
Frequency DAILY
Error Email Recipient [email protected]
Error Email Sender GENERAL CONTACT
Error Email Template LOG CLEANUP WARNING

One important thing(the hardest part): I need to fix that without the Community Maintenance Script or any solution not built-in.

Any help will be appreciated!

Upvotes: 1

Views: 2894

Answers (3)

MartyS
MartyS

Reputation: 101

This is because the cleaner depends on information in log_ tables to be related to report_event so it doesn't just do a delete from across every table, something like this:

sendto(4, "\370\0\0\0\3SELECT `event_table`.`event_id` FROM `report_event` AS `event_table`\n LEFT JOIN `log_visitor` AS `visitor_table` ON event_table.subject_id = visitor_table.visitor_id WHERE (visitor_table.visitor_id IS NULL) AND (event_table.subtype = 1) LIMIT 1000", 252, MSG_DONTWAIT, NULL, 0) = 252
sendto(4, "{\2\0\0\3DELETE FROM `report_event` WHERE (event_id IN('39848474', '39848475', '39848476', '39848477', '39848478', '39848479', '39848480', '39848481', '39848482', '39848483', '39848484', '39848485', '39848486', '39848487', '39848488', '39848489', '39848490', '39848491', '39848492', '39848493', '39848494', '39848495', '39848496', '39848497', '39848498', '39848499', '39848500', '39848501', '39848502', '39848503', '39848504', '39848505', '39848506', '39848507', '39848508', '39848509', '39848510', '39848511', '39848512', '39848513', '39848514', '39848515', '39848516', '39848517', '39848518', '39848519', '39848520', '39848521', '39848522'))", 639, MSG_DONTWAIT, NULL, 0) = 639

So if there isn't a corresponding row in the log_ tables you can see report_event slowly inflate.

Upvotes: 0

Jiří Chmiel
Jiří Chmiel

Reputation: 876

The relations between log DB tables could be broken (e.g. after manually cleaning). If you suspect a problem might be there then try to check your DB:

If DB query

SELECT COUNT(*) FROM log_url LEFT JOIN log_visitor ON (log_url.visitor_id = log_visitor.visitor_id) WHERE log_visitor.visitor_id IS NULL

returns a positive number, then there are some log records that are not relates to any visitor. Those records never removed by log cleaning. In that case execute

DELETE FROM log_url WHERE visitor_id NOT IN (SELECT visitor_id FROM log_visitor)

After that execute cleaning log again. In console terminal execute

php -f shell/log.php -- clean --days X

where X is day limit. It could be help you.

Upvotes: 0

Oscprofessionals
Oscprofessionals

Reputation: 2174

  1. If your cron is set and crontab setting are set as per frequencies then logs should be cleaned.

  2. My thoughts are that due to some error. Generally timeout or memory errors your cron is not able to complete its execution. Ss check your logs and var reports if any exceptin due to cron.

Upvotes: 1

Related Questions