summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan van den Dorpe <johan.vandendorpe@gmail.com>2013-03-11 16:47:28 +0000
committerJohan van den Dorpe <johan.vandendorpe@gmail.com>2013-03-11 23:06:23 +0000
commitcd214870c9e787cdd8e54645b430edd8f0a649cc (patch)
tree39e55fd432c08c31b9b14a78b2faa1d5986aeb1a
parent8c409b4fa29861ee073a7eb3e50fe60e6afe7a32 (diff)
Rename server.conf.erb to server-default.conf.erb and create _default partial templates
Split out server template into two parts: server/_default-{header,footer}.conf.erb which hold unchaning values server-default.conf.erb which contains commonly modified values, and imports _default.conf.erb
-rw-r--r--templates/server-default.conf.erb (renamed from templates/server.conf.erb)39
-rw-r--r--templates/server/_default-footer.conf.erb13
-rw-r--r--templates/server/_default-header.conf.erb20
3 files changed, 40 insertions, 32 deletions
diff --git a/templates/server.conf.erb b/templates/server-default.conf.erb
index dbb1a5f..fdf32d1 100644
--- a/templates/server.conf.erb
+++ b/templates/server-default.conf.erb
@@ -1,27 +1,12 @@
# File is managed by puppet
-<% if scope.lookupvar('rsyslog::server::enable_udp') -%>
-# Load UDP module
-$ModLoad imudp
-<% end -%>
-
-<% if scope.lookupvar('rsyslog::server::enable_tcp') -%>
-# Load TCP module
-$ModLoad imtcp
-<% end -%>
-
-<% if scope.lookupvar('rsyslog::server::high_precision_timestamps') == false -%>
-#
-# Use traditional timestamp format.
-# To enable high precision timestamps, comment out the following line.
-#
-$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
-<% end -%>
-
-# Switch to remote ruleset
-$RuleSet remote
+<% # Common header across all templates -%>
+<%= scope.function_template(['rsyslog/server/_default-header.conf.erb']) %>
+# Log files are stored in directories matching the short hostname, excluding numbers
+# i.e. web01 web02 and web03 will all log to a the web directory
<% if scope.lookupvar('rsyslog::server::enable_onefile') == false -%>
+
# Templates
$Template dynAuthLog,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/auth.log"
$Template dynSyslog,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/syslog"
@@ -53,15 +38,5 @@ $Template dynAllMessages,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>
*.* -?dynAllMessages
<% end -%>
-# Switch back to default ruleset
-$RuleSet RSYSLOG_DefaultRuleset
-
-<% if scope.lookupvar('rsyslog::server::enable_udp') -%>
-$InputUDPServerBindRuleset remote
-$UDPServerRun 514
-<% end -%>
-
-<% if scope.lookupvar('rsyslog::server::enable_tcp') -%>
-$InputTCPServerBindRuleset remote
-$InputTCPServerRun 514
-<% end -%>
+<% # Common footer across all templates -%>
+<%= scope.function_template(['rsyslog/server/_default-footer.conf.erb']) %>
diff --git a/templates/server/_default-footer.conf.erb b/templates/server/_default-footer.conf.erb
new file mode 100644
index 0000000..7ba4750
--- /dev/null
+++ b/templates/server/_default-footer.conf.erb
@@ -0,0 +1,13 @@
+
+# Switch back to default ruleset
+$RuleSet RSYSLOG_DefaultRuleset
+
+<% if scope.lookupvar('rsyslog::server::enable_udp') -%>
+$InputUDPServerBindRuleset remote
+$UDPServerRun 514
+<% end -%>
+
+<% if scope.lookupvar('rsyslog::server::enable_tcp') -%>
+$InputTCPServerBindRuleset remote
+$InputTCPServerRun 514
+<% end -%>
diff --git a/templates/server/_default-header.conf.erb b/templates/server/_default-header.conf.erb
new file mode 100644
index 0000000..19eb173
--- /dev/null
+++ b/templates/server/_default-header.conf.erb
@@ -0,0 +1,20 @@
+<% if scope.lookupvar('rsyslog::server::enable_udp') -%>
+# Load UDP module
+$ModLoad imudp
+<% end -%>
+
+<% if scope.lookupvar('rsyslog::server::enable_tcp') -%>
+# Load TCP module
+$ModLoad imtcp
+<% end -%>
+
+<% if scope.lookupvar('rsyslog::server::high_precision_timestamps') == false -%>
+#
+# Use traditional timestamp format.
+# To enable high precision timestamps, comment out the following line.
+#
+$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
+<% end -%>
+
+# Switch to remote ruleset
+$RuleSet remote