Request: Statistic reset

Please follow the below template, it will help us to help you!

Please ensure that you are running the latest version of the beta code.
Run pihole -up to update to the latest, then verify that the problem still exists before reporting it.

Problem with Beta 5.0:

Debug Token:

Is it possible to add a (safe) function to reset the ftl-statistics? While searching for it I only found a solution by deleting the old database.

An example where this is usefull: Getting a exact view on the summary after deleting or deactivating an upstream-DNS.

Thanks in advance to all of you for the awesome work!

You could try

sudo service pihole-FTL stop
sudo sqlite3 /etc/pihole/pihole-FTL.db "DELETE FROM queries WHERE timestamp > (cast(strftime('%s', 'now') as int))-24*60*60"
sudo service pihole-FTL start

This will selectively remove the last 24 hours without destroying the entire database.

I think this would nicely fit into the "Danger Zone!" in Settings/System

I don't agree. This is not a frequently performed task and generally falls into the "edge case" category. Adding code for this occasional use is not warranted, in my opinion.

How often do you press "Flush logs" or "Disable query logging"?

Flushing logs does flush the long-term database, but only the last 24h. This seems a bit counterintuitive - why does it flush at all (not not just the logs) and why not all data?

1 Like

Because it involves an FTL restart. And FTL would re-import the history when it would still be in the database. The net effect would be that everything looks to be still there.

Because this was originally meant more in a "I want to hide some things happened recently" way. Very much like browsers offer you to delete the data only partially (without loosing everything). I can see that there may be a need to get both. However, flushing the entirety of the logs can easily be obtained by deleting the database. Flushing it only partially is a bit more involved as you need an SQL instruction.

1 Like