Pi-Hole question / Blocked Queries being reset each day?
from Sunny@slrpnk.net to selfhosted@lemmy.world on 14 Sep 2024 16:15
https://slrpnk.net/post/13327410

Hi there, I’ve just done the switch from NextDNS to PiHole. Simply because I want to test it out + self-host my DNS. I set up PiHole+Unbound two days ago, and yesterday the amount of “Queries blocked” was much higher that it is now. But this morning the number was down back to 100ish. Is this normal behaviour, is it supposed to reset the counter? I’d rather it didn’t. Let me know if this is my fault or a setting I’ve managed to miss.

Thank you.

#selfhosted

threaded - newest

solidgrue@lemmy.world on 14 Sep 2024 16:18 next collapse

That counter, I believe, for the last 24 hours. It will fluctuate up and down across your active daily periods

Sunny@slrpnk.net on 14 Sep 2024 16:23 collapse

Oh okay good to know, is there a way to change this though? Would be “cooler” to see the total amount imo.

solidgrue@lemmy.world on 14 Sep 2024 16:30 collapse

So, like a running sum? No, I don’t think so, not in Pi-hole at least.

Pi-hole does have an API you could scrape, though. A Prometheus stack could track it and present a dashboard that shows the summation you want. There are other stats you could pull as well. This is a quick sample of what my home assistant integration sees

<img alt="" src="https://lemmy.world/pictrs/image/752cf391-a0c8-4497-aaa8-58569ba21fc0.png">

just_another_person@lemmy.world on 14 Sep 2024 16:33 collapse

None of you ever check the docs first, huh…

solidgrue@lemmy.world on 14 Sep 2024 16:36 collapse

Ah, well if you know differently then please do share with the rest of us? I think the phrasing in my post makes it pretty clear I was open to being corrected.

just_another_person@lemmy.world on 14 Sep 2024 16:32 next collapse

docs.pi-hole.net/ftldns/configfile/?h=statistics#…

solidgrue@lemmy.world on 14 Sep 2024 16:43 collapse

#### MAXLOGAGE=24.0
Up to how many hours of queries should be imported from the database and logs? Values greater than the hard-coded maximum of 24h need a locally compiled `FTL` with a changed compile-time value.

I assume this is the setting you are suggesting can extend the query count period. It still will only give you the last N hours’ worth of queries, which is not what OP asked. I gather OP wants to see the cumulative total of blocked queries over all time, and I doubt the FTL database tracks the data in a usable way to arrive at that number.

[deleted] on 14 Sep 2024 16:51 next collapse

.

[deleted] on 14 Sep 2024 16:56 next collapse

.

[deleted] on 14 Sep 2024 17:41 collapse

.

[deleted] on 14 Sep 2024 23:22 collapse

.

[deleted] on 14 Sep 2024 23:35 collapse

.

[deleted] on 15 Sep 2024 00:40 collapse

.

Sunny@slrpnk.net on 14 Sep 2024 22:07 collapse

Thanks anyway dude

solidgrue@lemmy.world on 14 Sep 2024 22:22 next collapse

No worries, the other poster was just wasn’t being helpful. And/or doesn’t understand statistics & databases, but I don’t care to speculate on that or to waste more of my time on them.

The setting above maxes out at 24h in stock builds, but can be extended beyond that if you are willing to recompile the FTL database with different parameters to allow for a deeper look back window for your query log. Even at that point, a second database setting farther down that page sets the max age of all query logs to 1y, so at best you’d get a running tally of up to a year. This would probably at the expense of performance for dashboard page loads since the number is probably computed at page load. The live DB call is intended for relatively short windows vs database lifetime.

If you want an all-time count, you’ll have to track it off box because FTL doesn’t provide an all-time metric, or deep enough data persistence. I was just offering up a methodology that could be an interesting and beneficial project for others with similar needs.

Hey, this was fun. See you around.

Sunny@slrpnk.net on 15 Sep 2024 08:15 collapse

Appreciate the explanation, have a good one 👊

shiiiiiiiiiiiiiiiiiiiiiiiiiiiiiit@sh.itjust.works on 15 Sep 2024 07:51 collapse

If it helps, Adguard Home has individual settings of 24h, 7d, 30d, 90d for logs and stats.

Sunny@slrpnk.net on 15 Sep 2024 08:13 collapse

I will try that one next to see how it compares. Thanks for letting me know 👍

RandomPancake@lemmy.world on 14 Sep 2024 18:21 next collapse

Make sure you’re also blocking all other outbound DNS at your firewall. Many “smart” devices (and presumably some apps, though I have no way to check this) are hard coded to use 8.8.8.8 regardless of what DCHP says to use.

uranibaba@lemmy.world on 15 Sep 2024 00:23 collapse

Install Pi-Hole to block ads but use DNS server provided by the biggest ad company? o.O

JaddedFauceet@lemmy.world on 15 Sep 2024 00:45 collapse

No he is saying that many smart devices ignore your DNS (pi-hole) as they hardcoded their DNS address to 8.8.8.8. So it is important to have an additional layer to block at the firewall.

uranibaba@lemmy.world on 23 Sep 10:11 collapse

Ah, gotcha! Thanks

sazey@lemmy.world on 15 Sep 2024 08:25 collapse

Although not exactly what you are looking for (ie custom counters on the landing page), you can view counters you are after on another page under ‘Long-term Data > Query Log’

<img alt="" src="https://lemmy.world/pictrs/image/733c11f8-f197-4d29-9eeb-d27e04fe3e3e.png">

<img alt="" src="https://lemmy.world/pictrs/image/5909ecd4-e1e5-42dc-95d3-eba046f9d536.png">

<img alt="" src="https://lemmy.world/pictrs/image/a721d2ac-3d76-45bf-b44c-a07f4862045a.png">

Sunny@slrpnk.net on 15 Sep 2024 08:27 collapse

Thanks this is good too!