Ubuntu – Isc_stdio_open ‘/var/log/bind9/query.log’ failed: permission denied

16.04bindserver

/etc/apparmor.d/usr.sbin.named 

/var/log/bind9/** rw,
/var/log/bind9/ rw,

/etc/bind/named.conf.options
options {
        directory "/var/cache/bind";
        auth-nxdomain no;
        listen-on-v6 { any; };
        statistics-file "/var/cache/bind/named.stats";
        rrset-order {order cyclic;};
    allow-transfer { 127.0.0.1; };
};
logging {
        channel b_query {
                file "/var/log/bind9/query.log" versions 2 size 1m;
                print-time yes;
                severity info;
        };
        category queries { b_query; };
};

service bind9 status

isc_stdio_open '/var/log/bind9/query.log' failed: permission denied

I have already created bind9 in /var/log and added root:bind with permission 755

I have already restarted apparmor and bind9
Same error.
What is wrong ?

Best Answer

On /etc/apparmor.d/usr.sbin.named

/var/log/named/** rw,
/var/log/named/ rw,

You must adjust permissions or dir here.

Some people like to put logs in /var/log/named/ instead of having syslog do the heavy lifting.