Skip to content

Allow configuration of logging options #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
16 changes: 16 additions & 0 deletions manifests/server/conf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
# and the value is an array of config lines. Default: empty
# $includes:
# Array of absolute paths to named.conf include files. Default: empty
# $logging:
# Hash containing channel: hash of channels, and category: hash of categroies
#
# Sample Usage :
# bind::server::conf { '/etc/named.conf':
Expand All @@ -88,6 +90,19 @@
# 'secret "aaabbbcccddd"',
# ],
# }
# logging => {
# channel => {
# foo => [
# ' file "/var/named/foo"',
# 'severity info'
# ]
# },
# category => {
# default => [
# 'foo'
# ]
# }
# }
# }
#
define bind::server::conf (
Expand Down Expand Up @@ -121,6 +136,7 @@
$keys = {},
$includes = [],
$views = {},
$logging = {},
) {

# OS Defaults
Expand Down
24 changes: 24 additions & 0 deletions templates/named.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,28 @@ options {
bindkeys-file "/etc/named.iscdlv.key";
};

<% if [email protected]? -%>
logging {
<% if @logging['channel'] and !@logging['channel'].empty? -%>
<% @logging['channel'].sort_by {|key,value| key}.each do |key,value| -%>
channel <%= key %> {
<% value.each do |line| -%>
<%= line %>;
<% end -%>
}
<% end -%>
<% end -%>
<% if @logging['category'] -%>
<% @logging['category'].sort_by {|key,value| key}.each do |key,value| -%>
<% if !value.empty? -%>
category <%= key %> { <%= value.join('; ') %>; };
<% else -%>
category <%= key %> { };
<% end -%>
<% end -%>
<% end -%>
};
<% else -%>
logging {
channel main_log {
file "/var/log/named/named.log" versions 3 size 5m;
Expand All @@ -116,6 +138,8 @@ logging {
null;
};
};
<% end -%>

<% if [email protected]? -%>

<% @views.sort_by {|key,value| key}.each do |key,value| -%>
Expand Down