How to use specific log file rather than syslog?

Shane Castle swcxt at co.boulder.co.us
Tue Feb 1 19:40:52 UTC 2000


In comp.protocols.dns.bind, Barry Margolin<barmar at bbnplanet.com> wrote:
>In article <20000127155003.COQU25012.mail.rdc1.il.home.com at mercury.snydernet.lan>,
>Steve Snyder <swsnyder at home.com> wrote:
>>I want to direct all BIND (v8.2.2P5) log entries to its own log file 
>>rather than to the system log.  
>>
>>Can someone advise me on a simple way to redirect BIND's logging?

>We put the following in named.conf:

>        channel syslog_info {
>                syslog local7;        // send to syslog's local7 facility
>                severity info;        // only send priority info and higher
>        };
>        channel syslog_notice {
>                syslog local7;        // send to syslog's local7 facility
>                severity notice;      // only send priority notice and higher
>        };

>This causes named's log messages to be sent using facility code "local7",
>rather than the default of "daemon".  Then our syslog.conf contains:

>local7.debug         /var/log/named.log

...and, I hope, a line for the normal system log that contains something
like

*.info,local7.none	/var/adm/messages

Otherwise you will get all named's messages in both /var/log/named.log
AND /var/adm/messages.

Also, some mechanism for ageing the log files might be in order.  We have
as part of a script that runs every weekend (Korn shell script):

# Slide down old named logs
if [ -f /var/log/named.log ]
then 
    # slide the log files down
    mv /var/log/named.log.5 /var/log/named.log.6 2>/dev/null
    mv /var/log/named.log.4 /var/log/named.log.5 2>/dev/null
    mv /var/log/named.log.3 /var/log/named.log.4 2>/dev/null
    mv /var/log/named.log.2 /var/log/named.log.3 2>/dev/null
    mv /var/log/named.log.1 /var/log/named.log.2 2>/dev/null
    mv /var/log/named.log.0 /var/log/named.log.1 2>/dev/null
    cp /var/log/named.log   /var/log/named.log.0 2>/dev/null
    cat /dev/null >/var/log/named.log 2>/dev/null
fi

kill -HUP $(</etc/syslog.pid)


--
Shane Castle             | "Perfection, then, is finally achieved, not
Boulder County Info Svcs | when there is nothing left to add, but when
Boulder CO USA           | there is nothing left to take away."
                         |                - Antoine de Saint-Exupéry



More information about the bind-users mailing list