Is it possible to remove entries from database

I have an old network IP range on my LAN. I would like to remove all entries from the historical database starting with 192.168.1.* ... is this possible?

This will do it for a single IP. I'll have to ponder on how to remove a range.

sudo sqlite3 /etc/pihole/pihole-FTL.db "Delete from queries where client='192.168.1.2'"

Paging our resident SQL expert for a better command to remove the entire domain range. @PromoFaux

Thank you, I ran that command once, per IP, but I am still seeing records in my "Top Clients (total)" list. Is that to be expected?

Yes, until either you restart FTL (pihole restardns) or 24 hours has elapsed. The display on the dashboard is initially populated by querying the long term database for the most recent 24 hours, and then continued population is done real time.

1 Like

Thank you. I would love to know if it is possible to use a wildcard. Will wait for @PromoFaux

It may not be a wildcard - it may be a "contains" command. I vaguely recall such a command, but neglected to save it for reference.

The operator you are looking for is LIKE (https://www.sqlitetutorial.net/sqlite-like/)

In your case WHERE client LIKE '192.168.1.%'

2 Likes

Working example and thank you both:

sqlite3 /etc/pihole/pihole-FTL.db "Delete from queries where client like '192.168.9.%'"

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.