# Generated by Chef
<% @servers.each.with_index(1) do |server, index| -%>
$ActionQueueType LinkedList # use asynchronous processing
$ActionQueueFileName srvrfwd<%= index %> # set file name, also enables disk mode
$ActionResumeRetryCount -1 # infinite retries on insert failure
$ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down
$ActionQueueMaxDiskSpace <%= node['rsyslog']['action_queue_max_disk_space'] %> # Don't use more than this much space for the queue
<% if node['rsyslog']['enable_tls'] && node['rsyslog']['tls_ca_file'] -%>
$DefaultNetstreamDriverCAFile <%= node['rsyslog']['tls_ca_file'] %>
<%   if node['rsyslog']['tls_certificate_file'] -%>
$DefaultNetstreamDriverCertFile <%= node['rsyslog']['tls_certificate_file'] %>
<%   end -%>
<%   if node['rsyslog']['tls_key_file'] -%>
$DefaultNetstreamDriverKeyFile <%= node['rsyslog']['tls_key_file'] %>
<%   end -%>

$DefaultNetstreamDriver gtls
$ActionSendStreamDriverMode 1
$ActionSendStreamDriverAuthMode <%= node['rsyslog']['tls_auth_mode'] %>
<% if node['rsyslog']['tls_permitted_peer'] -%>
$ActionSendStreamDriverPermittedPeer <%= node['rsyslog']['tls_permitted_peer'] %>
<% end -%>
<% end -%>

<%   case server['protocol'] -%>
<%     when "tcp" -%>
<%=      server['logs'] ? server['logs'] : node['rsyslog']['logs_to_forward'] %> @@<%= server['server']  %>:<%= server['port'] ? server['port'] : node['rsyslog']['port'] %><%= server['remote_template'] ? ';' + server['remote_template'] : nil %>
<%     when "udp" -%>
<%=      server['logs'] ? server['logs'] : node['rsyslog']['logs_to_forward'] %> @<%= server['server']  %>:<%= server['port'] ? server['port'] : node['rsyslog']['port'] %><%= server['remote_template'] ? ';' + server['remote_template'] : nil %>
<%     else -%>
<%=      server['logs'] ? server['logs'] : node['rsyslog']['logs_to_forward'] %><%= node['rsyslog']['protocol'] == "tcp" ? " @@" : " @" %><%= server['server']  %>:<%= server['port'] ? server['port'] : node['rsyslog']['port'] %><%= server['remote_template'] ? ';' + server['remote_template'] : nil %>
<%   end -%>

<% end -%>
