diff --git a/templates/client/config.conf.erb b/templates/client/config.conf.erb index f4afabe..c75a894 100644 --- a/templates/client/config.conf.erb +++ b/templates/client/config.conf.erb @@ -1,15 +1,7 @@ -# An "In-Memory Queue" is created for remote logging. -$WorkDirectory <%= scope.lookupvar('rsyslog::spool_dir') -%> # where to place spool files -$ActionQueueFileName queue # unique name prefix for spool files -$ActionQueueMaxDiskSpace <%= scope.lookupvar('rsyslog::client::spool_size') -%> # spool space limit (use as much as possible) -$ActionQueueSaveOnShutdown on # save messages to disk on shutdown -<% if scope.lookupvar('rsyslog::client::spool_timeoutenqueue') -%> -$ActionQueueTimeoutEnqueue <%= scope.lookupvar('rsyslog::client::spool_timeoutenqueue') -%> # time to wait before discarding on full spool -<% end -%> -$ActionQueueType LinkedList # run asynchronously -$ActionResumeRetryCount -1 # infinety retries if host is down -<% if scope.lookupvar('rsyslog::client::log_templates') and ! scope.lookupvar('rsyslog::client::log_templates').empty?-%> +# Set working directory +$WorkDirectory <%= scope.lookupvar('rsyslog::spool_dir') -%> +<% if scope.lookupvar('rsyslog::client::log_templates') and ! scope.lookupvar('rsyslog::client::log_templates').empty?-%> # Define custom logging templates <% scope.lookupvar('rsyslog::client::log_templates').flatten.compact.each do |log_template| -%> $template <%= log_template['name'] %>,"<%= log_template['template'] %>" diff --git a/templates/client/remote.conf.erb b/templates/client/remote.conf.erb index 5c02cfa..bb23054 100644 --- a/templates/client/remote.conf.erb +++ b/templates/client/remote.conf.erb @@ -1,5 +1,5 @@ <% if scope.lookupvar('rsyslog::client::remote_servers') -%> -<% scope.lookupvar('rsyslog::client::remote_servers').flatten.compact.each do |server| -%> +<% scope.lookupvar('rsyslog::client::remote_servers').flatten.compact.each_with_index do |server, index| -%> <% if server['pattern'] and server['pattern'] != ''-%> <% pattern = server['pattern'] -%> <% else -%> @@ -44,12 +44,28 @@ <% dropaction = '' -%> <% end -%> # Sending logs that match <%= pattern %> to <%= host %> via <%= protocol_type %> on <%= port %> using <%=format_type %> format. +$ActionQueueFileName queue.<%= index %> # unique name prefix for spool files +$ActionQueueMaxDiskSpace <%= scope.lookupvar('rsyslog::client::spool_size') -%> # spool space limit (use as much as possible) +$ActionQueueSaveOnShutdown on # save messages to disk on shutdown +<% if scope.lookupvar('rsyslog::client::spool_timeoutenqueue') -%> +$ActionQueueTimeoutEnqueue <%= scope.lookupvar('rsyslog::client::spool_timeoutenqueue') -%> # time to wait before discarding on full spool +<% end -%> +$ActionQueueType LinkedList # run asynchronously +$ActionResumeRetryCount -1 # infinety retries if host is down <%= pattern %> <%= protocol %><%= host %>:<%= port %><%= format %> <%= dropaction %> <% end -%> <% elsif scope.lookupvar('rsyslog::client::log_remote') -%> # Log to remote syslog server using <%= scope.lookupvar('rsyslog::client::remote_type') %> +$ActionQueueFileName queue # unique name prefix for spool files +$ActionQueueMaxDiskSpace <%= scope.lookupvar('rsyslog::client::spool_size') -%> # spool space limit (use as much as possible) +$ActionQueueSaveOnShutdown on # save messages to disk on shutdown +<% if scope.lookupvar('rsyslog::client::spool_timeoutenqueue') -%> +$ActionQueueTimeoutEnqueue <%= scope.lookupvar('rsyslog::client::spool_timeoutenqueue') -%> # time to wait before discarding on full spool +<% end -%> +$ActionQueueType LinkedList # run asynchronously +$ActionResumeRetryCount -1 # infinety retries if host is down <% if scope.lookupvar('rsyslog::client::remote_type') == 'tcp' -%> *.* @@<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;<%= scope.lookupvar('rsyslog::client::remote_forward_format') -%> <% else -%>