# Bind Logging (solved)

## vaguy02

I'm trying to get BIND to do some better logging rather than just the standard named starting stopping etc. It is chroot'ed, but I don't think that makes a difference in this case.

Those are the error messages:

 *Quote:*   

> 
> 
> Jan 25 02:02:59 Zeus named[31494]: logging channel 'client_file' file '/var/log/bind/client.log': file not found
> 
> Jan 25 02:02:59 Zeus named[31494]: logging channel 'unmatched_file' file '/var/log/bind/unmatched.log': file not found
> ...

 

ls -la

 *Quote:*   

> 
> 
> Zeus bind # ls -la
> 
> total 8
> ...

 

named.conf

 *Quote:*   

> 
> 
> logging {
> 
>   channel default_file { file "/var/log/bind/default.log" versions 3 size 5m; severity dynamic; print-time yes; };
> ...

 

----------

## bunder

change ownership of the files and the folder to "named" or the user it runs as.

hope that helps   :Wink: 

----------

## vaguy02

logging files

 *Quote:*   

> 
> 
> Zeus bind # ls -la
> 
> total 8
> ...

 

messages

 *Quote:*   

> 
> 
> ]
> 
> Zeus log # tail named.log
> ...

 

No change, Sorry. Any other ideas? I really thought that one was going to work.

----------

## doctork

I expect your problem is the chroot.  Try running it without the chroot, or create the [chroot_path]/var/log directory.

doc

----------

## bunder

 *Quote:*   

> drwxr-xr-x 2 root root 4096 Jan 25 02:02 . 

 

that one too.   :Wink: 

----------

## vaguy02

Still No go. Sorry, Anything else?

 *Quote:*   

> 
> 
> Zeus bind # ls -la
> 
> total 8
> ...

 

 *Quote:*   

> Zeus bind # tail /var/log/named.log
> 
> Jan 25 13:44:46 Zeus named[3330]: logging channel 'client_file' file '/var/log/bind/client.log': file not found
> 
> Jan 25 13:44:46 Zeus named[3330]: logging channel 'unmatched_file' file '/var/log/bind/unmatched.log': file not found
> ...

 

----------

## doctork

You say your running chroot.

What's the value of CHROOT in /etc/conf.d/named?

If you used the instructions in that file for doing chroot, then what's the result of 

```
ls -lR /chroot/dns
```

doc

----------

## vaguy02

 *Quote:*   

> What's the value of CHROOT in /etc/conf.d/named? 

 

```

# Set various named options here.

#

OPTIONS=""

# Set this to the number of processors you have.

#

CPU="1"

# If you wish to run bind in a chroot, run:

# emerge --config =<bind-version>

# and un-comment the following line.

# You can specify a different chroot directory but MAKE SURE it's empty.

CHROOT="/chroot/dns"

# Default pid file location

PIDFILE="${CHROOT}/var/run/named/named.pid"

# Scheduling priority: 19 is the lowest and -20 is the highest.

#

NAMED_NICELEVEL="0"

```

 *Quote:*   

> 
> 
> Code:
> 
> ls -lR /chroot/dns
> ...

 

```

Zeus conf.d # ls -lR /chroot/dns

/chroot/dns:

total 12

drwxr-xr-x 2 root  root  4096 Jan 25 02:41 dev

drwxr-xr-x 3 root  root  4096 Dec 11 13:07 etc

drwxr-xr-x 4 named named 4096 Dec 11 13:07 var

/chroot/dns/dev:

total 0

srw-rw-rw- 1 root root    0 Jan 25 02:41 log

crw-rw-rw- 1 root root 1, 8 Dec 11 13:07 random

crw-rw-rw- 1 root root 1, 5 Dec 11 13:07 zero

/chroot/dns/etc:

total 8

drwxr-xr-x 2 root root 4096 Jan 25 02:03 bind

-rw-r--r-- 1 root root  255 Dec 11 13:07 localtime

/chroot/dns/etc/bind:

total 12

-rw-r--r-- 1 root  root  4962 Jan 25 02:01 named.conf

lrwxrwxrwx 1 root  root    18 Dec 11 13:07 pri -> ../../var/bind/pri

-rw------- 1 named named   77 Dec 11 13:07 rndc.key

lrwxrwxrwx 1 root  root    18 Dec 11 13:07 sec -> ../../var/bind/sec

/chroot/dns/var:

total 8

drwxr-xr-x 4 named named 4096 Dec 11 13:07 bind

drwxr-xr-x 3 named named 4096 Dec 11 13:07 run

/chroot/dns/var/bind:

total 12

-rw-r--r-- 1 named named 2878 Dec 11 13:07 named.ca

drwxr-xr-x 2 named named 4096 Dec 30 15:14 pri

lrwxrwxrwx 1 named named   23 Dec 11 13:07 root.cache -> ../../var/bind/named.ca

drwxr-xr-x 2 named named 4096 Dec 11 13:07 sec

/chroot/dns/var/bind/pri:

total 12

-rw-r--r-- 1 named named 227 Dec 11 13:07 127.zone

-rw-r--r-- 1 named named 423 Dec 11 13:07 localhost.zone

-rw-r--r-- 1 named named 423 Dec 30 15:14 poison.zone

/chroot/dns/var/bind/sec:

total 0

/chroot/dns/var/run:

total 4

drwxr-xr-x 2 named named 4096 Jan 25 13:44 named

/chroot/dns/var/run/named:

total 4

-rw-r--r-- 1 named named 5 Jan 25 13:44 named.pid

```

----------

## doctork

So it looks like you need to create /chroot/dns/var/log/bind, no?

doc

----------

## vaguy02

How's this:

 *Quote:*   

> 
> 
> /chroot/dns/var/log:
> 
> total 0
> ...

 

Do I reference /chroot/dns/var/log in my named.conf file in the chroot dir?

----------

## doctork

I've never run named/chroot on Gentoo, but did so on RedHat in a previous incarnation.  Further, I've alwas used syslog logging for named and sorted things out with syslog-ng.  This should work if you actually create the directory /chroot/dns/var/log/bind.  That needs to belong to named:named, like the rest of the stuff in /chroot/dns.  Then, if for convenience sake you want to do a symbolic link from that directory to /var/log/bind, you can do so.

doc

----------

## doctork

 *Quote:*   

> Do I reference /chroot/dns/var/log in my named.conf file in the chroot dir?

 

Oops, didn't answer the question.  No, you don't reference /chroot/dns in you named.conf file -- you leave the definitions in you named.conf as you originally defined them.

doc

----------

## scherz0

 *vaguy02 wrote:*   

> How's this:
> 
>  *Quote:*   
> 
> /chroot/dns/var/log:
> ...

 

For a process with root in /chroot/dns/,  this symlink is pointing to itself !

 *Quote:*   

> 
> 
> Do I reference /chroot/dns/var/log in my named.conf file in the chroot dir?

 

No, leave it as /var/log/.  For a process rooted at /chroot/dns/,  /chroot/dns/var/log/ does not exit.

As previously written, just create /chroot/dns/var/log/bind/ with the right permissions, and it should be ok.

----------

## vaguy02

Reloaded without the chroot, logging fine now. Thanks guys.

----------

