Logrotate for bind9

Browne, Stuart Stuart.Browne at team.neustar
Thu Jul 5 07:53:22 UTC 2018


How about a clear, direct example of using external service 'logrotate' (this is from one of my redhat systems, but the same concept applies to Ubuntu/Debian):

[bekar at dns-nomnom1.den ~]$ cat /etc/logrotate.d/named
/var/log/named/*.log {
  compress
  create 0644 named named
  daily
  dateext
  missingok
  notifempty
  rotate 30
  sharedscripts
  postrotate
    /usr/sbin/rndc reconfig > /dev/null 2>/dev/null || true
  endscript
}

We put our logs in the custom location of '/var/log/named/'; if you put them somewhere else, you'll need to change that. The other settings are direct references to Anand's email. Finally, you'll want to change the 30 to 180 to keep 180 different days worth of logs.

BIND internally doesn't have the concept based rotation, only size-based rotation. In order to achieve per-day logs, you'll need to use the external tool 'logrotate' (or similar) for your rotation. If you do that, you'll want to disable BIND's rotation in the logs configuration (if you're using that currently), so not this:

logging {
        channel ns_log {
                file "/var/log/named/named.log" versions 3 size 256M;
                severity dynamic;
                print-time yes;
                print-severity yes;
                print-category yes;
        };
...
        category default { ns_log; };
        category general { ns_log; };
        category config { ns_log; };
};

But this:

logging {
        channel ns_log {
                file "/var/log/named/named.log";
                severity dynamic;
                print-time yes;
                print-severity yes;
                print-category yes;
        };
...
        category default { ns_log; };
        category general { ns_log; };
        category config { ns_log; };
};

Hope this clarifies the idea a little for you.

Stuart

From: bind-users [mailto:bind-users-bounces at lists.isc.org] On Behalf Of Blason R
Sent: Thursday, 5 July 2018 4:44 PM
To: bicweld at gmail.com
Cc: bind-users
Subject: Re: Logrotate for bind9

What exactly are those? Well what I wated to achieve here is to rotate the logs daily and start new file; then compress

On Thu, Jul 5, 2018 at 6:21 AM Rohan Henry <bicweld at gmail.com<mailto:bicweld at gmail.com>> wrote:
Why not use Bind logging option?

On Jul 4, 2018 8:51 AM, "Blason R" <blason16 at gmail.com<mailto:blason16 at gmail.com>> wrote:
Hi There,

I am not getting appropriate results for my custom daily logrorate for bind9 logs on Ubuntu.

Can someone please help me with the settings which would include below   stuff

  1.  Should rotate daily
  2.  Compress
  3.  create new file
  4.  keep last 180 entries


Do I need stop bind9 while logs are being rotated? What is the correct procedure to start logs in new file?

_______________________________________________
Please visit https://lists.isc.org/mailman/listinfo/bind-users<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.isc.org_mailman_listinfo_bind-2Dusers&d=DwMFaQ&c=MOptNlVtIETeDALC_lULrw&r=udvvbouEjrWNUMab5xo_vLbUE6LRGu5fmxLhrDvVJS8&m=x_efXEDdzrHXkr39lk-t7Ive0PUrBu39XyHVKIxYr-c&s=I6mnsNje8UKA-DWyQZnQG_y1ejr_e49gbkmN5JNAZrs&e=> to unsubscribe from this list

bind-users mailing list
bind-users at lists.isc.org<mailto:bind-users at lists.isc.org>
https://lists.isc.org/mailman/listinfo/bind-users<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.isc.org_mailman_listinfo_bind-2Dusers&d=DwMFaQ&c=MOptNlVtIETeDALC_lULrw&r=udvvbouEjrWNUMab5xo_vLbUE6LRGu5fmxLhrDvVJS8&m=x_efXEDdzrHXkr39lk-t7Ive0PUrBu39XyHVKIxYr-c&s=I6mnsNje8UKA-DWyQZnQG_y1ejr_e49gbkmN5JNAZrs&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20180705/a6d461f3/attachment.html>


More information about the bind-users mailing list