Bind logging configuration

Configuring the way bind logs events works essentially in two steps: first we need to configure the channels bind will use for logging, then we have to specify which event we like to log to a particular channel.

Step 1: create the directory for storing logs"

   #> mkdir /var/log/bind
   #> chown bind.bind /var/log/bind

Step 2: update named.conf configuration file

   logging {
           channel b_log {
                   file "/var/log/bind/bind.log" versions 9 size 1m;
                    print-time yes;
                    print-category yes;
                    print-severity yes;
                    severity info;
           };
           channel b_query {
                   file "/var/log/bind/query.log" versions 4 size 1m;
                   print-time yes;
                   severity info;
           };
           category default { default_syslog; default_debug; b_log; };
           category queries { b_query; };
    };

All parameters are well covered in the bind documentation, so please refer to it for an in-depth explanation; I'll just add a quick note about versions and size parameters.

versions tells bind to keep a fixed numbers of backups of the log file (it acts like a rotation mechanism similar to logrotate), while size specifies the maximum size of the log file (once the size exceed, logs are rotated).