Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ Optionally: If you want to adjust the allow-query option globally, here is a sam
bind_config_allow_query: [ '127.1.0.1', '127.1.0.2' ]


Optionally: You can enable logging (this creates one file per channel):

bind_logging_enabled: on

Optionally: You can configure log files size, versions, logging severity and path:
bind_logging_path: /var/log/named
bind_logging_file_versions: 3
bind_logging_file_size: 5m
bind_logging_severity: dynamic

## Dependencies

None.
Expand All @@ -75,3 +85,4 @@ MIT
## Author Information

René Moser <mail@renemoser.net>
Logging configuration borrowed from <a href="">Steven Carr</a> from a <a href="https://stackoverflow.com/a/12114139/907592">StackOverflow's answer</a>.
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ bind_masterzones_path: "masters"
bind_slavezones_path: "slaves"
bind_config_listen_on: any
bind_config_allow_query: []
bind_logging_enabled: off
bind_logging_path: /var/log/named
bind_logging_file_versions: 3
bind_logging_file_size: 5m
bind_logging_severity: dynamic
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@
notify: reload bind
tags: bind-zones

- name: Create log directory
file: path={{ bind_logging_path }} state=directory owner={{ bind_user }} group={{ bind_group }} mode=0755
when: bind_logging_enabled

- name: start/stop bind service
service: name={{ bind_service_name }} state={{ bind_service_state }} enabled={{ bind_service_enabled }}
108 changes: 108 additions & 0 deletions templates/named.conf.options.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,111 @@ options {
recursion {{ bind_config_recursion }}; // Do not provide recursive service
zone-statistics yes;
};

{% if bind_logging_enabled %}
logging {
channel default_file {
file "{{ bind_logging_path }}/default.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel general_file {
file "{{ bind_logging_path }}/general.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel database_file {
file "{{ bind_logging_path }}/database.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel security_file {
file "{{ bind_logging_path }}/security.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel config_file {
file "{{ bind_logging_path }}/config.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel resolver_file {
file "{{ bind_logging_path }}/resolver.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel xfer-in_file {
file "{{ bind_logging_path }}/xfer-in.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel xfer-out_file {
file "{{ bind_logging_path }}/xfer-out.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel notify_file {
file "{{ bind_logging_path }}/notify.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel client_file {
file "{{ bind_logging_path }}/client.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel unmatched_file {
file "{{ bind_logging_path }}/unmatched.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel queries_file {
file "{{ bind_logging_path }}/queries.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel network_file {
file "{{ bind_logging_path }}/network.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel update_file {
file "{{ bind_logging_path }}/update.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel dispatch_file {
file "{{ bind_logging_path }}/dispatch.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel dnssec_file {
file "{{ bind_logging_path }}/dnssec.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};
channel lame-servers_file {
file "{{ bind_logging_path }}/lame-servers.log" versions {{ bind_logging_file_versions }} size {{ bind_logging_file_size }};
severity {{ bind_logging_severity }};
print-time yes;
};

category default { default_file; };
category general { general_file; };
category database { database_file; };
category security { security_file; };
category config { config_file; };
category resolver { resolver_file; };
category xfer-in { xfer-in_file; };
category xfer-out { xfer-out_file; };
category notify { notify_file; };
category client { client_file; };
category unmatched { unmatched_file; };
category queries { queries_file; };
category network { network_file; };
category update { update_file; };
category dispatch { dispatch_file; };
category dnssec { dnssec_file; };
category lame-servers { lame-servers_file; };
};
{% endif %}