{% if __rsyslog_output.tcp_port | d() %}
{%   set __forwards_port = __rsyslog_output.tcp_port %}
{%   set __forwards_protocol = 'tcp' %}
{% elif __rsyslog_output.udp_port | d() %}
{%   set __forwards_port = __rsyslog_output.udp_port %}
{%   set __forwards_protocol = 'udp' %}
{% else %}
{%   set __forwards_port = '' %}
{%   set __forwards_protocol = '' %}
{% endif %}
ruleset(name="{{ __rsyslog_output.name }}") {
{% if __rsyslog_output.property | d() %}
    :{{ __rsyslog_output.property }}, {{ __rsyslog_output.property_op | d('contains') }}, "{{ __rsyslog_output.property_value | d('error') }}" action(name="{{ __rsyslog_output.name }}"
{% elif __rsyslog_output.exclude | d([]) %}
    {{ __rsyslog_output.facility | d('*') }}.{{ __rsyslog_output.severity | d('*') }};{{ __rsyslog_output.exclude | join(';') }} action(name="{{ __rsyslog_output.name }}"
{% else %}
    {{ __rsyslog_output.facility | d('*') }}.{{ __rsyslog_output.severity | d('*') }} action(name="{{ __rsyslog_output.name }}"
{% endif %}
        type="omfwd"
        Target="{{ __rsyslog_output.target }}"
{% if __rsyslog_output.tls | d(false) | bool %}
        StreamDriver="{{ __rsyslog_tls_netstream_driver }}"
        StreamDriverMode="1"
        StreamDriverAuthMode="{{ __rsyslog_output.pki_authmode | d(__rsyslog_default_pki_authmode) }}"
        StreamDriverPermittedPeers="{{ __rsyslog_output.permitted_server | d('*.' + logging_domain) }}"
{% endif %}
{% if __forwards_port != '' %}
        Port="{{ __forwards_port }}"
{% endif %}
{% if __forwards_protocol != '' %}
        Protocol="{{ __forwards_protocol }}"
{% endif %}
{% if __rsyslog_output.template | d('') == 'traditional' %}
        Template="RSYSLOG_TraditionalForwardFormat"
{% elif __rsyslog_output.template | d('') == 'syslog' %}
        Template="RSYSLOG_SyslogProtocol23Format"
{% else %}
        Template="RSYSLOG_ForwardFormat"
{% endif %}
    )
}
