Skip to content

Reading the Query Log

Scope: the log as the product — every question your house asks, who asked it, and what the engine did, with the status vocabulary translated and the statistics that summarise them. The log and the statistics were read live from the lab engine's API throughout.

The one-screen version

Ask the API for the latest questions (the web interface's Query Log page shows the same data as a table) and the lab's test queries stand there in order, each with its verdict:

nas.home.arpa         CACHE      (answered locally)
telemetry.specimen.test  GRAVITY  (a blocklist name)
popups.specimen.test  DENYLIST   (your exact rule)
ads.specimen.test     GRAVITY    (a blocklist name)

(from transcript t02, lightly trimmed; each entry also carries the asking client, the reply, and how long it took — the local record above was answered in about a ten-thousandth of a second.)

That is the whole idea of the log: not a debug dump, but the house's diary of questions. The first time most people open it, the discovery is not the blocking — it's which device asks for what, how often, at 3 a.m. A television checking in with its maker every few minutes is normal to see. Now you can see it.

The status words, translated

The engine uses a fixed vocabulary; these are the ones a household will meet, all of them observed in the lab except where noted:

Status Meaning
FORWARDED sent to your upstream, which answered
CACHE answered from the engine's memory of a recent identical answer
GRAVITY refused: on a blocklist (compile: chapter 3)
DENYLIST refused: your exact deny rule
REGEX refused: one of your regex rules
(local names) your own records report inside CACHE, answered from the desk itself

Two reading skills matter more than the vocabulary. First, CACHE is a verdict about timing as much as truth — it means "same answer as a moment ago", which is usually right and is also why tests run seconds after a rule change can lie to you (chapter 3's two-second ghost). Second, a blocked name you don't recognise is information, not automatically a problem: the log is how devices confess what they do, and most confessions are mundane.

The summary, and what it's for

Alongside the log, the engine keeps running statistics — the numbers behind the web interface's dashboard:

"queries": { "total": 42, "blocked": 11,
             "percent_blocked": 26.19, ... }

(lab numbers after the transcripts' tests; transcript t09 has the full status breakdown — GRAVITY 4, DENYLIST 6, REGEX 1, FORWARDED 4, CACHE 27.)

Read the percentage with suspicion, in both directions. A chatty house with one loud telemetry-spewing TV will show an alarming percentage while nothing is wrong; a quiet house can show 4% while the one name that matters sails through because it isn't on any list. The percentage is a weather report, not a grade. The log — names, devices, verdicts — is where understanding lives; the summary is just its headline.

Privacy: whose diary is this?

A log of every name every device asked for is, read plainly, a record of the household's interests and hours. Pi-hole keeps it by default because the log is the product — but the engine offers privacy levels that progressively stop recording which client asked and then what was asked at all, up to a mode that keeps only counts. Blocking works identically at every level; only the diary thins. The honest defaults conversation is short: if the log's usefulness to you is real, keep it and treat the Pi-hole's own storage and admin password with the respect a diary deserves (it is one more reason the web password of chapter 2 is not optional); if it isn't, turn the recording down and lose nothing but hindsight. What you shouldn't do is keep a full diary by accident because nobody mentioned it was one.

Query history is held in the engine's long-term database and aged out on a setting (database.maxDBdays) rather than kept forever — the startup log shows the engine importing its stored queries across restarts (transcript t07), which is the same persistence that lets the dashboard show you last week.

Check: given one log line, you should be able to say who asked, what they asked, which rule or route decided the answer, and whether the answer came from the desk, the cache, or upstream. That is the entire operating skill of Pi-hole; the remaining chapters are judgement calls (chapter 7), maintenance (chapter 8), and the limits of the whole idea (chapter 9).