What to do to purge logs?

Hello,

I’m sorry to ask this as it might be obvious for an experienced user but how and where do I run the following the code to purge my
logs? It is not mentioned on the FAQ page. Thank you!

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() - 30

Kind Regards,
A.J. Angel

Aren’t there anyone who could help with providing a reply? style_emoticons/<#EMO_DIR#>/sad.gif

you run it directly in the database, with some sql tool, either the mysql cli or for example phpmyadmin.

I have phpMyAdmin. Could you tell me what to do exactly? I would appreciate any help I could get. style_emoticons/<#EMO_DIR#>/wink.gif

Assuming that your sql-statement is correct, you can copy it an run it directly in phpmyadmin. phpmyadmin allows you to run the statement in the tab “sql”.

Thank you! It did the trick. style_emoticons/<#EMO_DIR#>/smile.gif

I also wish to ask, when pruning the logs, does it affect the database size? Or it doesn’t? Does it get reduced?

Finally, is it also possible to prune logs for a particular month? I have an installation where began using it mid-month and I wish to prune logs for that month.

In my installation it seems like this does not affect database size… strange. How can I actually get rid of data?

run an “optimize” command on the given tables in the database.

I’m an SQL noob… thank you very much!

This might be a good addition for the FAQ page.

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