Delete statistic tool


(SxM) #1

It’s not possible to implement like php-stat a user friendly panel to manage statistic ? style_emoticons/<#EMO_DIR#>/wink.gif

See screenshot below

[attachment=2051:del_stats.jpg]


(Ian) #2

Could you please be a bit more specific about the use case? What database actions need to be taken and why? (For example “Sometimes for troubleshooting you need to drop the piwik_archive_* tables and then re-run archiving. Provide a one-click interface for doing so.”)

It looks like the screenshot is indicating clearing of the history. Why, outside of testing, would you need to do this? Just trying to understand what you’re asking for.

How about these two for starters?

  1. Drop all historical visits for this site from specified date range, or ALL.
  2. Drop all archive tables and re-run archiving. (perhaps auto triggered after #1?)

(SxM) #3

It’s simply to delete the stat without using mysql panel style_emoticons/<#EMO_DIR#>/smile.gif a user friendly panel for newbee like me or also for people that don’t need to archive stats.

Instead of

  1. Log in in your mysql panel

2)Delete all *archive table

3)Run sql command DELETE FROM piwik_log_visit WHERE idsite = X AND 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

I’m so newbie that i can’t really understand the difference deleting stats between explainded in :

1)How can I purge Piwik logs? (in piwik.org/faq/troubleshooting/))

2)How do I delete all statistics for a given websites, or for all websites? (in piwik.org/faq/how-to/))

Your starters are really good style_emoticons/<#EMO_DIR#>/cool.gif


(Matthieu Aubry) #4

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


#5

The GeoIP plugin instructs users to “drop all piwik_archive_* tables in your Piwik database” but does not explain how to do this.


#6

After looking into the Mysql manual and considering/discarding a blog post “MySQL: how to drop multiple tables using single query”, I worked around the issue this way:

(1) On the command line:
mysql -u username -p dbname
enter password when prompted (all 3 details can be found in piwik/config/config.ini.php )

(2) Mysql prompt:
show tables like ‘piwik_archive_%’;

(3) copy and paste lines with table names to text editor
(4) search and replace "| " at start of lines with "drop table "
(5) search and replace “[ ]*|” at end of lines with “;”
(6) copy and paste modified lines back to mysql prompt
(7) confirm with show tables like ‘piwik_archive_%’; that tables are gone
(8) type “exit” to exit mysql prompt


#7

For testing purposes, it will also be useful to provide the option to delete archives for a specific month since re-running archiving can be very time-consuming.

For example, in my case of testing the GeoIP plugin, it would have been sufficient to re-build data for the current month to see that it doesn’t fix the “World Map”. (I eventually found a forum post indicating that the plugin does not update the country information in core widgets but brings its own widgets but unfortunately no world map.)