bind logging configuration

Create the directory for storing logs:

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

Update named.conf configuration file

Bind logging works 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 which channel.

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 explained in the bind documentation, so I'll just add a quick note about version and size. version 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).