Home   >>   BIND   >>   How To Configure DNS BIND logging on Linux
How To Configure DNS BIND logging on Linux PDF Print E-mail
( 0 Votes )
How To - BIND
Written by Christian Foronda   
Thursday, 16 June 2011 17:17

I assume you already have BIND installed . This is tested to work on BIND 9.

CentOS (BIND is chrooted):

Create the configuration file:

# vi /var/named/chroot/etc/named.logs

logging {
    channel queries.log { 
        file "/var/log/queries.log";
        severity dynamic;
        print-time yes;
    };
    category queries { queries.log; };

    channel security.log {
        file "/var/log/security.log";
        severity dynamic;
        print-time yes;
    };
    category security { security.log; };

    channel client.log {
        file "/var/log/client.log";
        severity dynamic;
        print-time yes;
    };
    category client { client.log; };

    channel network.log {
        file "/var/log/network.log";
        severity dynamic;
        print-time yes;
    };
    category network { network.log; };
    
    channel resolver.log {
        file "/var/log/resolver.log";
        severity dynamic;
        print-time yes;
    };
    category resolver { resolver.log; };

    channel default.log {
        file "/var/log/default.log";
        severity dynamic;
        print-time yes;
    };
    category default { default.log; };

    channel config.log {
        file "/var/log/config.log";
        severity dynamic;
        print-time yes;
    };
    category config { config.log; };

    channel xfer-in.log {
        file "/var/log/xfer-in.log";
        severity dynamic;
        print-time yes;
    };
    category xfer-in { xfer-in.log; };

    channel xfer-out.log {
    channel notify.log {
        file "/var/log/notify.log";
        severity dynamic;
        print-time yes;
    };
    category notify { notify.log; };

    channel lame-servers.log {
        file "/var/log/lame-servers.log";
        severity dynamic;
        print-time yes;
    };
    category lame-servers { lame-servers.log; };

};

 

Create a soft link:

# ln -s /var/named/chroot/etc/named.logs /etc/

 

Edit BIND configuration named.conf:

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

 

Comment out the lines below:

/*logging {
*        channel default_debug {
*                file "data/named.log";
*                severity dynamic;
*        };
*/};

 

Add the line below at the end of the file:

include  "/etc/named.logs";

 

Check for syntax errors:

# named-checkconf

 

If no errors detected, reload BIND:

# rndc reload

 

Ubuntu (BIND is not chrooted):

Create the configuration file:

# vi /etc/bind/named.conf.logs

 

logging {
    channel queries.log { 
        file "logs/queries.log";
        severity dynamic;
        print-time yes;
    };
    category queries { queries.log; };

    channel security.log {
        file "logs/security.log";
        severity dynamic;
        print-time yes;
    };
    category security { security.log; };

    channel client.log {
        file "logs/client.log";
        severity dynamic;
        print-time yes;
    };
    category client { client.log; };

    channel network.log {
        file "logs/network.log";
        severity dynamic;
        print-time yes;
    };
    category network { network.log; };
    
    channel resolver.log {
        file "logs/resolver.log";
        severity dynamic;
        print-time yes;
    };
    category resolver { resolver.log; };

    channel default.log {
        file "logs/default.log";
        severity dynamic;
        print-time yes;
    };
    category default { default.log; };

    channel config.log {
        file "logs/config.log";
        severity dynamic;
        print-time yes;
    };
    category config { config.log; };

    channel xfer-in.log {
        file "logs/xfer-in.log";
        severity dynamic;
        print-time yes;
    };
    category xfer-in { xfer-in.log; };

    channel xfer-out.log {
    channel notify.log {
        file "logs/notify.log";
        severity dynamic;
        print-time yes;
    };
    category notify { notify.log; };

    channel lame-servers.log {
        file "logs/lame-servers.log";
        severity dynamic;
        print-time yes;
    };
    category lame-servers { lame-servers.log; };

};

 

Edit BIND configuration named.conf:

# vi /etc/bind/named.conf

 

Add the line below at the end of the file:

include  "/etc/bind/named.conf.logs";

 

Create the logs directory:

# mkdir /var/cache/bind/logs

 

Check for syntax errors:

# named-checkconf

 

If no errors detected, reload BIND:

# rndc reload

 




blog comments powered by Disqus