Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking into setting up a PowerDNS server to handle a few hundred zones. I'd like to keep track the "usage" of each zone and record, i.e. the number of queries per day to each.

I couldn't find any details in the documentation or in Google on how I might achieve this. I'm unfamiliar with PowerDNS, but thinking a custom PipeBackend is needed? Do PipeBackends replace a standard MySQL backend, in addition to, or only for unresolved queries?

share|improve this question
up vote 4 down vote accepted

PowerDNS cannot currently do this. There are external tools, like dsc that can do stats via pcap.

If you were to write a custom (pipe)backend for this, it would have to replace your mysql-backend -- you can't tell powerdns to feed results from one backend through another. 'pipebackend' is perhaps a bit confusing in that sense.

Note that any statistics you would do from a backend (be it a custom backend, or be it your mysql query log) would be skewed by the (optional, but recommended) packet- and query-cache inside PowerDNS.

So, right now I would recommend using something like dsc.

share|improve this answer
Thanks @Habbie! – Kevin Mar 18 '12 at 0:16

As for the the pipe backend question:

All backends are exhausted for queries in the order that they are given in the launch statement. As soon as a backend responds with data matching the query all remaining backends will not be asked any further. So if you put a pipe backend that is just for generating statistics and not answering anything upfront you will catch all queries to you nameserver except those PowerDNS was able to answer from its packet and query caches.

share|improve this answer

Maybe the best option is adding a LUA hook before the PowerDNS cache options (packet- and query-cache). This way you can create a LUA script for the logging and let a backend answer the query. This way you can use the cache (for great performance) and use a tested backend (gmysql) for the response. You could even include some code to stop logging if it slows down your system to much.

If I'm correct there is already a LUA hook available just after the cache. For what you are looking for and also for rate limiting (when that is needed).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.