Logrotate Bind9

Suppose Bind9 logs are written to the /var/log/named/ directory, have the .log extension and so that the disk space does not overflow with logs, configure logrotate.

Create a file:

sudo nano /etc/logrotate.d/bind

And add the content to it:

/var/log/named/*.log {
  compress
  create 0644 bind bind
  daily
  dateext
  missingok
  notifempty
  rotate 10
  sharedscripts
  postrotate
    /usr/sbin/rndc reconfig > /dev/null 2>/dev/null || true
  endscript
}

Now logrotate will break logs into files daily and store them for no more than 10 days.

See also my article:
Configuring Bind9 logs

Join the Conversation

1 Comment

Leave a Reply