What to do to purge logs?


#1

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


#2

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


(Thomas Seifert) #3

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


#4

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


(Beatgarantie) #5

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”.


#6

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.


(thoro) #7

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


(Thomas Seifert) #8

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


(thoro) #9

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

This might be a good addition for the FAQ page.


(Matthieu Aubry) #10

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