Or: How to enhance the privacy of your Pi-hole

If you use a Pi-hole like I do, you probably care about privacy in some form. If you do, you should disable query logging and here’s why.

There are 5 privacy levels in Pi-Hole’s FTL DNS, going from 0 (show everything) to 4 (disable statistics).

But there’s a separate log, unrelated to the Pi-hole privacy levels, which potentially impacts privacy. The “Query logging”.

You know how some VPN services offer a “no log” policy? And there’s a reason for that. So keep on reading to know how to fix your Pi-hole’s privacy settings.

The “query logging” I am talking about, is the one that gets written to /var/log/pihole.log.

dnsmasq logging every domain to /var/log/pihole.log regardless of privacy settings

It has nothing to do with the query logging in the Pi-hole web interface and its stats.

Say you are concerned about privacy, like I am. I set my privacy level to (1) hide domains which means I still get stats, and logs, but in “anonymized” form. The actual domain names are converted to the string “hidden”.

So what’s the problem with query logging?

It undermines your privacy settings, as it logs everything regardless of your setting. This means that if you decide to hide domains, like I did, every request including the non-anonymized domain names, are still logged. You just don’t see it in the web interface, but it’s all there.

OK I get it now, but what can I do about it? And I still want nice web stats!

Disabling query logging has no effect on the stats in the Pi-hole web interface. It will also not affect the Pi-hole privacy levels. You can still have your stats!* Yay!

Disabling query logging

There are two ways to disabling query logging on the Pi-hole. The first and straightforward method, just requires to execute one command in the terminal.

The command is as simple as:
sudo pihole logging off
This will also clear /var/log/pihole.log so you’re done here!

The second method uses the Pi-hole web interface.
Simply navigate to your admin panel (usually http://pi.hole/admin) and sign in.
Next go to Settings > System > Disable query logging

Note that with the web interface method, /var/log/pihole.log will not get cleared. So I really recommend you to use the first method. Also, it seems that using the web interface also purges all your stats.*

*disabling query logging might purge your stats once, but it will then create new stats, so don’t panic.

Doing it right from the beginning

Next time you set up Pi-hole and it asks about whether to enable query logging, simply say “no”. That way you can set the Pi-hole privacy levels according to your liking, and they will be honoured, fully.

I hope this helped.