Provide the ability to not just get 'top' lists but get more results on demand. For instance, it would be quite nice to have a list of all the local clients that have requested a DNS lookup in a specified period or for the whole logged period.
Have a look at the "long term data" pages. Here, you can specify from when to when you want to have such statistics generated.
But that just seems to allow me to get all queries for that period. I just want a list of clients that have used Pi-Hole.
If you go to
Long term data -> Top Lists this will show you a list of the top clients over the selected period.
But I would like a list of all clients not just the top 10.
Okay, I figured that this would not be sufficient for you as you specifically asked for a
list of all the local clients that have requested a DNS lookup in a specified period
so I assumed you always wanted to access historic data.
Not sure what the distinction is of historic data. Does the API query all data in the logs or is it limited to recent past?
Everything within the most recent 24 hours is kept in memory and hence extremely fast available. Data that is queried beyond this needs to get loaded from the long-term database we keep on disk. As this involves a lot of reading from disk it is much slower, in comparison.
Although both data sources contain the same data (at least within the most recent 24 hours), we naturally have to distinguish between them as they way the data is accessible is drastically different.
Ah OK, really interesting.
So does the API call only query the information in memory?
If so, the design change I'd suggest is to break the 'Top Lists' from 'Long Term Data' into 3 separate pages (or just offer it as separate pages), that default to 10 items returned, but allow the number of items returned to be increased and use the same date/time picker.
Thanks for your time.
Yes. A similar API exists for long term data. Instead of
api.php you'd be using
api_db.php. However, be aware of that you will want to provide extra information (the time window in which you want to query the database), let me give an example:
This queries the database from Tuesday, February 6, 2018 4:18:15 PM (GMT) to Tuesday, February 6, 2018 4:18:15 PM (GMT). You can use something like https://www.epochconverter.com/ for converting. Unfortunately, the amount of clients cannot be changed right now, but if you need this we could consider adding an option for it.
Ok so it won't give me any more than the top clients page will give me then I think?
I think it would be useful.
old thread, But just might help someone.
Believe running this command from the terminal window would provide the same info. change the number within () is you have more than 90 clients
echo ">top-clients (90) >quit" | nc localhost 4711