Is it possible to purge logs before a certain date?

Hello,

I tried to use the code provided in the FAQ, changing 30 to 5 so that it would purge stats before September but something went wrong and stats before today got purged literally. This is the code I used:

DELETE piwik_log_visit, piwik_log_link_visit_action
FROM piwik_log_visit INNER JOIN piwik_log_link_visit_action
WHERE piwik_log_visit.idvisit = piwik_log_link_visit_action.idvisit
AND visit_server_date <= CURRENT_DATE() - 5

Kind Regards,
A.J. Angel

The feature of automatically deleting old older than 7/30/N days is now available in Piwik, under Settings > Privacy > Delete old logs from the database.

This is available in the latest 1.5 RC release, check it out now and report if you have suggestions, directly in this post: 301 Moved Permanently