The two main logging options are channel and category, which configure where logs go, and what information gets logged, respectively.
If no logging options are configured the default configuration is:
logging { category default { default_syslog; default_debug; }; category unmatched { null; }; };
NOTE: BIND 9 Channels:
A channel may be defined to go to:
NOTE: categories are:
logging{ channel my_file { file "log.msgs" versions 3 size 10k; severity dynamic; }; };
logging { channel my_syslog { syslog local0; // send to syslog's local0 facility. severity info; // only send severity info and higher }; };
NOTE: The facility can be specified to be any of the following: kern, user, mail, daemon, auth, syslog, lpr, news, uucp, cron, authpriv, ftp, local0, local1, local2, local3, local4, local5, local6, or local7.
The default is daemon, and this is the recommended option to be used.
NOTE: Channels allow you to filter by message severity. Here is the list of severities:
We need to configure a channel to specify which file to send the messages to, and a category.
In this example, the category will log all queries.
Edit /etc/bind/named.conf.local and add the following:
logging { channel query.log { file "/var/log/named/query.log"; severity debug 3; }; category queries { query.log; }; };
Since the named daemon runs as the bind user the /var/log/named directory must be created and the ownership changed:
sudo mkdir /var/log/named sudo chown bind:bind /var/log/named
Restart BIND9 for the changes to take effect:
sudo systemctl restart bind9.service
You should see the file /var/log/named/query.log fill with query information.
NOTE: This is a simple example of the BIND9 logging options.
For coverage of advanced options see More Information.