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.
Edit the /etc/named.conf file and in the options {} section these two lines:
zone-statistics yes; statistics-file "/var/named/slaves/named.stats";
Restart the named service.
service named restart
Run the command below. This will update the /var/named/slaves/named.stats file every time you run it.
rndc stats
Verify the /var/named/slaves/named.stats. In this example, only the Name server statistics are displayed.
++ 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
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.
Related articles
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.