Skip to content

Commit 633cbb3

Browse files
committed
Disable query logging default
By default, the bind formula will configure the named process to write all queries into a query.log file which potentially is outside the normal log-rotated dirs, thus filling up the disk. This is rather unexpected on high traffic DNS servers. Disable by default, can be explicity reenabled by setting enable_logging to True. Rework jinja logic to make enable_logging and use_extensive_logging mutually exclusive rather than having them "stacked". It makes no sense to have the fine-grained use_extensive_logging configuration depend on the coarse-grained enable_logging toggle. I am actually tempted to rename enable_logging to enable_query_log which is a much clearer description of the functionality. Comments? Somewhat related, log_dir is /var/log/something for every OS except Red Hat where it is defined as /var/named/data... Any reason not to fix that inconsistency other than the use of the chrooted functionality on Red Hat?
1 parent d7e5d82 commit 633cbb3

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

bind/files/named.conf.local.jinja

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,9 @@ view {{ view }} {
132132
};
133133
{%- endfor %}
134134

135-
{%- if salt['pillar.get']('bind:config:enable_logging', True) %}
136135
{%- if salt['pillar.get']('bind:config:use_extensive_logging', False) %}
137136
include "{{ map.logging_config }}";
138-
{% else %}
137+
{% elif salt['pillar.get']('bind:config:enable_logging', False) %}
139138
logging {
140139
channel "querylog" {
141140
file "{{ map.log_dir }}/query.log";
@@ -144,7 +143,6 @@ logging {
144143
category queries { querylog; };
145144
};
146145
{%- endif %}
147-
{%- endif %}
148146

149147
{%- if salt['pillar.get']('bind:controls', False) %}
150148
controls {

pillar.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ bind:
2828
user: root # File & Directory user
2929
group: named # File & Directory group
3030
mode: 640 # File & Directory mode
31-
enable_logging: true # Enable basic query logging
32-
use_extensive_logging: # Enable extensive config for logging. Partial example. For proposed settings please refer to
33-
channel: # https://kb.isc.org/article/AA-01526/0/BIND-Logging-some-basic-recommendations.html
34-
default_log:
31+
enable_logging: true # Enable basic query logging in $log_dir/query.log
32+
use_extensive_logging: # Alternatively, enable much more extensive config for logging.
33+
channel: # Partial example. For proposed settings please refer to
34+
default_log: # https://kb.isc.org/article/AA-01526/0/BIND-Logging-some-basic-recommendations.html
3535
file: default
3636
size: '200m' # size of a individual file (default 20m)
3737
versions: '10' # how many files will be stored (default 3)

0 commit comments

Comments
 (0)