enable loging in bind

From WebHostingNeeds.com
Jump to: navigation, search

Check if named is running chroot

[email protected] [/var/named]# ps aux | grep named
named     2850  4.2  0.2  65100  9500 ?        Ssl  05:57   0:00 /usr/sbin/named -u named -t /var/named/chroot
root      2871  0.0  0.0   4032   696 pts/0    S+   05:57   0:00 grep named
[email protected] [/var/named]#

If chroot, edit

vi /var/named/chroot/etc/named.conf

For non chroot, edit /etc/named.conf

vi /etc/named.conf


You may have default login configuration like

logging {
/*      If you want to enable debugging, eg. using the 'rndc trace' command,
 *      named will try to write the 'named.run' file in the $directory (/var/named).
 *      By default, SELinux policy does not allow named to modify the /var/named directory,
 *      so put the default debug log file in data/ :
 */
    channel default_debug {
            file "data/named.run";
            severity dynamic;
    };
};

Replace it with

logging {
category "default" { "debug"; };
category "general" { "debug"; };
category "database" { "debug"; };
category "security" { "debug"; };
category "config" { "debug"; };
category "resolver" { "debug"; };
category "xfer-in" { "debug"; };
category "xfer-out" { "debug"; };
category "notify" { "debug"; };
category "client" { "debug"; };
category "unmatched" { "debug"; };
category "network" { "debug"; };
category "update" { "debug"; };
category "dispatch" { "debug"; };
category "dnssec" { "debug"; };
category "lame-servers" { "debug"; };

category "queries" { "query_log"; };

channel "query_log" {
file "data/query.log" versions 2 size 50m;
print-time yes;
print-category yes;
};

channel "debug" {
file "data/named.run" versions 2 size 50m;
print-time yes;
print-category yes;
};
};

Now you will be able to see logs at /var/named/data/named.run

tail -f /var/named/data/named.run
tail -f /var/named/chroot/var/named/data/named.run

To see Query log, check /var/named/data/query.log

tail -f /var/named/data/query.log
tail -f /var/named/chroot/var/named/data/query.log


bind configuration file with loging enabled



bind