Configuring Bind9 logs

By default, Bind9 logs are written to the system log / var / log / syslog and to separate them, I will perform the actions that I will point out below.

On the test, I will configure Bind9 in Ubuntu Server 16.04.
Open the main Bind9 configuration file, for example, in the nano editor (Ctrl+X for exit, y/x for saving or canceling changes):

sudo nano /etc/bind/named.conf

Add to its end:

logging {
    channel bind.log {
        file "/var/lib/bind/bind.log" versions 10 size 20m;
        severity notice;
        print-category yes;
        print-severity yes;
        print-time yes;

        category queries { bind.log; };
        category default { bind.log; };
        category config { bind.log; };

The second example, or you can configure the saving of logs in different files:

logging {
          channel "misc" {
                    file "/var/log/named/misc.log" versions 4 size 4m;
                    print-time YES;
                    print-severity YES;
                    print-category YES;

          channel "query" {
                    file "/var/log/named/query.log" versions 4 size 4m;
                    print-time YES;
                    print-severity NO;
                    print-category NO;

          category default {

          category queries {

severity indicates the level of logging, it can be: critical, error, warning, notice, info, debug, dynamic.

Restart Bind9 to apply the changes:

sudo /etc/init.d/bind9 restart

You can make a reference to /var/log/ to make it easier for others to find them:

sudo ln -s /var/lib/bind/ /var/log/

To see logs in real time, you can use the command (Ctrl+C to stop the preview):

sudo tail -f /var/lib/bind/bind.log

If logging is done in a non-standard directory, then you need to allow this in the apparmor:

sudo nano /etc/apparmor.d/usr.sbin.named

See also:
Installing and Configuring DNS Server BIND9

Подписаться на IT Blog (RU) по Email
Subscribe to IT Blog (EN) by Email

Did my article help you? How about buying me a cup of coffee as an encouragement? Buy me a coffe.

Leave a Reply