2

I want to change the logging behavior of Bind9 on my server (Ubuntu 14.04.4 LTS). I found a intuitive manual for this here: Help.Ubuntu. In their example they only changed the logging behavior for queries. I want to log everything (default) in a new logfile and also stop the current logging to /var/log/syslog.

I created a file /var/log/bind.log and changed the owner to bind user (chown bind:bind /var/log/bind.log):

-rw-r--r--  1 bind          bind                 0 Mär  8 11:56 bind.log

Then I changed /etc/bind/named.conf.local and added

logging {
channel query.log {
    file "/var/log/bind.log";
    // Set the severity to dynamic to see all the debug messages.
    severity debug 3;
};

category default { query.log; };
};

Then I first tried to only do a reload: "service bind9 reload". No error output, but nothing appeared in the log-file. Then I did "service bind9 restart", but also (without any error-message) no logs appeared in my file.

Does anyone have a clue, what might went wrong? My first issues were, that I wrote into /etc/named.conf and had wrong file permissions. There I always got errors like:

rndc: 'reload' failed: file not found

But after seeing, that I had to use /etc/bind/named.conf.local the errors disappeared. When using "service bind9 reload" I get the warning:

WARNING: key file (/etc/bind/rndc.key) exists, but using default configuration file (/etc/bind/rndc.conf)

but I do not think, that the warning is related to my problem. What makes me sceptical is, that either /etc/named.conf nor /etc/bind/rndc.conf have any line that handles the current logging to my /var/log/syslog. Where is this handled? I expected to find some lines like:

logging {
category default { default_syslog; default_debug; };
category unmatched { null; };

};

But could not find them anywhere.

Stefan Wegener
  • 183
  • 1
  • 1
  • 10
  • Are you running Bind in a chroot? – HBruijn Mar 08 '16 at 13:09
  • Yes it's running in a chroot. – Stefan Wegener Mar 08 '16 at 13:33
  • Then: does the log file/path exist in the chroot i.e. do you have something like: `/var/named/chroot/var/log/bind.log` – HBruijn Mar 08 '16 at 13:55
  • Yes, in my case it's: /var/named/run-root/etc/ and named.conf and rndc.conf are there. But there is no named.conf.local. Maybe this is the reason why nothing is happening... what makes me sceptical ist that they have different owners: -rw-r--r-- 1 root root 2042 Mär 8 15:11 named.conf, -rw-r--r-- 1 10007 4001 480 Jan 23 2002 rndc.conf. – Stefan Wegener Mar 08 '16 at 14:14
  • I got a first solution for my problems: I used rsyslog and changed the destination of all entries of the named service that would be written to /var/log/syslog to another file. This is not a perfect solution, as it would be better to use Bind9 for defininig where its logs will be written, but it gave me a quick solution as long as I can not find out the problems with named.conf... – Stefan Wegener Mar 09 '16 at 07:43

0 Answers0