summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Zieger <me@saz.sh>2014-07-10 15:31:11 +0200
committerSteffen Zieger <me@saz.sh>2014-07-10 15:31:11 +0200
commita45f6bf343182f284aa35b2d23d3fe7711f94462 (patch)
tree47ec1d83b893f4b1bc36e25f4c56e19315db14e6
parente3cfc7bd8ecd39c257e68cad7b8c33d4fb9b4d3a (diff)
add parameter for setting the remote forward format, fixes #46
-rw-r--r--README.md29
-rw-r--r--manifests/client.pp127
-rw-r--r--templates/client.conf.erb4
3 files changed, 87 insertions, 73 deletions
diff --git a/README.md b/README.md
index ef16ddf..8532a82 100644
--- a/README.md
+++ b/README.md
@@ -19,13 +19,20 @@ Manage rsyslog client and server via Puppet
#### Variables and default values
```
class { 'rsyslog::client':
- log_remote => true,
- remote_type => 'tcp',
- log_local => false,
- log_auth_local => false,
- custom_config => undef,
- server => 'log',
- port => '514',
+ log_remote => true,
+ spool_size => '1g',
+ remote_type => 'tcp',
+ remote_forward_format => 'RSYSLOG_ForwardFormat',
+ log_local => false,
+ log_auth_local => false,
+ custom_config => undef,
+ custom_params => undef,
+ server => 'log',
+ port => '514',
+ remote_servers => false,
+ ssl_ca => undef,
+ log_templates => false,
+ actionfiletemplate => false
}
```
for read from file
@@ -149,11 +156,17 @@ The following lists all the class parameters this module accepts.
RSYSLOG::CLIENT CLASS PARAMETERS VALUES DESCRIPTION
-------------------------------------------------------------------
log_remote true,false Log Remotely. Defaults to true.
+ spool_size STRING Max size for disk queue if remote server failed. Defaults to '1g'.
remote_type 'tcp','udp' Which protocol to use when logging remotely. Defaults to 'tcp'.
+ remote_forward_format STRING Which forward format for remote servers should be used. Only used if remote_servers is false.
log_local true,false Log locally. Defaults to false.
log_auth_local true,false Just log auth facility locally. Defaults to false.
custom_config STRING Specify your own template to use for client config. Defaults to undef. Example usage: custom_config => 'rsyslog/my_config.erb
- server STRING Rsyslog server to log to. Will be used in the client configuration file.
+ custom_params TODO TODO
+ server STRING Rsyslog server to log to. Will be used in the client configuration file. Only used, if remote_servers is false.
+ port '514' Remote server port. Only used if remote_servers is false.
+ remote_servers Array of hashes Array of hashes with remote servers. See documentation above. Defaults to false.
+ ssl_ca STRING SSL CA file location. Defaults to undef.
log_templates HASH Provides a has defining custom logging templates using the `$template` configuration parameter.
actionfiletemplate STRING If set this defines the `ActionFileDefaultTemplate` which sets the default logging format for remote and local logging.
diff --git a/manifests/client.pp b/manifests/client.pp
index f8a2120..193aa33 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -1,63 +1,64 @@
-# == Class: rsyslog::client
-#
-# Full description of class role here.
-#
-# === Parameters
-#
-# [*sample_parameter*]
-# [*spool_size*]
-# [*log_local*]
-# [*log_auth_local*]
-# [*custom_config*]
-# [*custom_params*]
-# [*log_remote*]
-# [*server*]
-# [*remote_type*]
-# [*port*]
-# [*remote_servers*]
-# [*ssl_ca*]
-# [*log_templates*]
-# [*actionfiletemplate*]
-#
-# === Variables
-#
-# === Examples
-#
-# class { 'rsyslog::client': }
-#
-class rsyslog::client (
- $log_remote = true,
- $spool_size = '1g',
- $remote_type = 'tcp',
- $log_local = false,
- $log_auth_local = false,
- $custom_config = undef,
- $custom_params = undef,
- $server = 'log',
- $port = '514',
- $remote_servers = false,
- $ssl_ca = undef,
- $log_templates = false,
- $actionfiletemplate = false
-) inherits rsyslog {
-
- if $custom_config {
- $content_real = template($custom_config)
- } else {
- $content_real = template("${module_name}/client.conf.erb")
- }
-
- rsyslog::snippet { $rsyslog::client_conf:
- ensure => present,
- content => $content_real,
- }
-
- if $rsyslog::ssl and $ssl_ca == undef {
- fail('You need to define $ssl_ca in order to use SSL.')
- }
-
- if $rsyslog::ssl and $remote_type != 'tcp' {
- fail('You need to enable tcp in order to use SSL.')
- }
-
-}
+# == Class: rsyslog::client
+#
+# Full description of class role here.
+#
+# === Parameters
+#
+# [*log_remote*]
+# [*spool_size*]
+# [*remote_type*]
+# [*remote_forward_format*]
+# [*log_local*]
+# [*log_auth_local*]
+# [*custom_config*]
+# [*custom_params*]
+# [*server*]
+# [*port*]
+# [*remote_servers*]
+# [*ssl_ca*]
+# [*log_templates*]
+# [*actionfiletemplate*]
+#
+# === Variables
+#
+# === Examples
+#
+# class { 'rsyslog::client': }
+#
+class rsyslog::client (
+ $log_remote = true,
+ $spool_size = '1g',
+ $remote_type = 'tcp',
+ $remote_forward_format = 'RSYSLOG_ForwardFormat',
+ $log_local = false,
+ $log_auth_local = false,
+ $custom_config = undef,
+ $custom_params = undef,
+ $server = 'log',
+ $port = '514',
+ $remote_servers = false,
+ $ssl_ca = undef,
+ $log_templates = false,
+ $actionfiletemplate = false
+) inherits rsyslog {
+
+ if $custom_config {
+ $content_real = template($custom_config)
+ } else {
+ $content_real = template("${module_name}/client.conf.erb")
+ }
+
+ rsyslog::snippet { $rsyslog::client_conf:
+ ensure => present,
+ content => $content_real,
+ }
+
+ if $rsyslog::ssl and $ssl_ca == undef {
+ fail('You need to define $ssl_ca in order to use SSL.')
+ }
+
+ if $rsyslog::ssl and $remote_type != 'tcp' {
+ fail('You need to enable tcp in order to use SSL.')
+ }
+
+}
diff --git a/templates/client.conf.erb b/templates/client.conf.erb
index c10512c..bb40627 100644
--- a/templates/client.conf.erb
+++ b/templates/client.conf.erb
@@ -72,9 +72,9 @@ $ActionSendStreamDriverAuthMode anon
# Log to remote syslog server using <%= scope.lookupvar('rsyslog::client::remote_type') %>
<% if scope.lookupvar('rsyslog::client::remote_type') == 'tcp' -%>
-*.* @@<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;RSYSLOG_ForwardFormat
+*.* @@<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;<%= scope.lookupvar('remote_forward_format') -%>
<% else -%>
-*.* @<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;RSYSLOG_ForwardFormat
+*.* @<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;<%= scope.lookupvar('remote_forward_format') -%>
<% end -%>
<% end -%>
<% if scope.lookupvar('rsyslog::client::log_auth_local') or scope.lookupvar('rsyslog::client::log_local') -%>