1 | DNS Exercise 4.3: Setting up Flexible Logging |
---|
2 | ============================================= |
---|
3 | |
---|
4 | Named logs by default are sent and captured in the /var/log/messages file. |
---|
5 | Other log messages are by default also sent to the /var/log/messages file. |
---|
6 | It is possible to change where BIND or named sends its log files. This |
---|
7 | exercise demonstrates how to change where BIND or named captures its logs. |
---|
8 | |
---|
9 | Edit the `/etc/namedb/named.conf` file and make the following |
---|
10 | entries just below the options { ...}; section. |
---|
11 | |
---|
12 | > logging { |
---|
13 | > channel default_log { |
---|
14 | > file "/var/log/named.log" versions 3 size 10m; |
---|
15 | > print-time yes; |
---|
16 | > print-category yes; |
---|
17 | > print-severity yes; |
---|
18 | > severity info; |
---|
19 | > }; |
---|
20 | > |
---|
21 | > channel xfrs { |
---|
22 | > file "/var/log/xfer.log" versions 5 size 5m; |
---|
23 | > print-time yes; |
---|
24 | > print-category yes; |
---|
25 | > print-severity yes; |
---|
26 | > severity info; |
---|
27 | > }; |
---|
28 | > |
---|
29 | > channel qrs { |
---|
30 | > file "/var/log/queries.log" versions 5 size 5m; |
---|
31 | > print-time yes; |
---|
32 | > print-category yes; |
---|
33 | > print-severity yes; |
---|
34 | > severity info; |
---|
35 | > }; |
---|
36 | > |
---|
37 | > category default { default_log; }; |
---|
38 | > category xfer-in { xfrs; }; |
---|
39 | > category xfer-out { xfrs; }; |
---|
40 | > category queries { qrs; }; |
---|
41 | > }; |
---|
42 | |
---|
43 | o Reconfigure your nameserver using `rndc reconfig` |
---|
44 | |
---|
45 | # rndc reconfig |
---|
46 | |
---|
47 | o Look into the `/var/named/var/log` directory, you should see the |
---|
48 | following files `named.log`, `queries.log` and `xfer.log`. |
---|
49 | |
---|
50 | Now default logging will be to named.log, query logs in the queries.log file, |
---|
51 | and zone transfer logs will be in xfer.log. |
---|
52 | |
---|