Top list in command line


#1

Hello!

Thank you for making pi-hole!

Being able to see the list of most requested domains in the webinterface is nice, but it would be even better for my setup if I were able to get that list on the command line or in a text file. More specifically, I would like to generate a list of the top (maybe 50, maybe more) most requested domains of the last 24 hours and another list over the last 7 days.

Some background of what I am trying to do: Right now, my RPi is running both pi-hole and unbound. The latter acting as a proxy to enable DNS-over-TLS. Unfortunately this is very slow, which is why I forced unbounds cache time to 24 hours. To increase performance further my idea was to renew the cache of the most requested domains every night. That way, those domains would always be answered from cache and never had to be queried when a client is trying to access them. Maybe doing this every 24 hours is not enough and I will change it to every 6 hours, simultaneously lowering the cache time.

In short, what I am asking for is something like this:
# pihole --top-domains -n 4 -h 24 --show-count
connectivitycheck.gstatic.com 2034
mqtt-mini.facebook.com 1972
mtalk.google.com 1720
api-global.netflix.com 992

Is that already possible? If not, would you consider implementing it?

Cheers,
Niels


#2

Take a look at the options in FTLDNS:

https://docs.pi-hole.net/ftldns/telnet-api/