# Log each haproxy backend traffic into its own log file

<% if node['haproxy']['backends']['roles'] -%>
  <% node['haproxy']['backends']['roles'].each do |backendName,backend| -%>
# TODO - syslogfacility-text doesn't match; find the proper syntax, then add it back
# if $syslogfacility-text == 'local2' and $msg contains '<%= backendName %>/' then /var/log/haproxy/<%= backendName %>.log
if $syslogfacility-text == 'local2' and $msg contains '<%= backendName %>/local_<%= backendName %>' then /var/log/haproxy/<%= backendName %>.log
& ~
  <% end -%>
<% end -%>

local2.* /var/log/haproxy/haproxy.log
& ~
