Skip to content
Command Line Interface

How to find out how many DNS queries are being made

WARNING

Applies to DNS Manager 4.X with BIND 9.2 or higher!

Knowing how many queries are being made by your server can help you track possible attacks and gain an insight into the most queried domains.

Step-by-step guide

Assuming you are using a CentOS server with BIND version higher than 9.2, we recommend that you take the following steps.

  1. Edit the /etc/named.conf file and in the options {} section these two lines:

    zone-statistics yes;
    statistics-file "/var/named/slaves/named.stats";
  2. Restart the named service.

    bash
      service named restart
  3. Run the command below. This will update the /var/named/slaves/named.stats file every time you run it.

    bash
     rndc stats
  4. Verify the /var/named/slaves/named.stats. In this example, only the Name server statistics are displayed.

    bash
       ++ Name Server Statistics ++
                         56 IPv4 requests received
                         47 recursive queries rejected
                         56 responses sent
                         8 queries resulted in successful answer
                         14 queries resulted in authoritative answer
                         6 queries resulted in nxrrset
                         42 other query failures

INFO

In case you want to do graphs, you need to add the "rndc stats" command to cronjob and use Cacti on a different server to output these stats.

Last updated: Dec 11, 2025