Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to get an accurate estimate of how many queries/{day,week,month} my DNS servers process for a specific subset of zones. I ran "rndc stats" and got a statistics file out of the deal, but it includes queries for ALL zones, and I need statistics for only a subset. I have the thought that this can be accomplished by adding "zone-statistics no" to the zone{ } part of the zone file, but I'm not confident to just try it and see what happens. Is this the correct procedure, or is there another way?

OS: OpenSuSE 11.2 BIND: 9.5

Thanks,

Kendall

share|improve this question

3 Answers 3

up vote 1 down vote accepted

zone-statistics is the way.

You either set it yes globally (in "options") and set no for non-interesting zones, or vice-versa - set no globally and yes for zones of interest.

--cut here--

Actually you have 3 ways to obtain statistics:

  1. rndc stats
  2. HTTP (statistics-channel)
  3. Queries log (will log ALL queries for ALL zones)

Obviously if what you need is just statistics, 1 and 2 are the right ways. To control them per-zone you use zone-statistics statement. Logging (3) can't be controlled per zone inside BIND.

share|improve this answer
    
In a nutshell, this is what I did. Simply turned off stats tracking globally, and turned it on in the relevant file(s) for the zones I was interested in. Obtained the needed results. –  Kendall Dec 20 '11 at 17:10

This isn't particularly elegant, but here goes.

In your configuration (same place you'd put zone{} blocks, but not inside one), add something like this:

logging {
    channel query_log {
        file "/var/log/named.queries"; // or somewhere else
        print-time yes;
    };
    category queries { query_log; };
 };

You'd be responsible for analyzing the file (grep ... | wc or something) yourself.

You might also want to consider log rotation if you don't want the file to grow forever. Bind has some built-in support for rolling over logs based on file size or named restarts, or you could use something external like logrotate. Bind's logging options are detailed at http://www.zytrax.com/books/dns/ch7/logging.html

share|improve this answer

Bind support statistics. Cjeck the detail in the Bind 9 Configuration Reference. I think you want to set zone-statistics to yes to do what you want.

share|improve this answer

Your Answer

 
discard

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.