{# If both udp_ports and tcp_ports appear in the __rsyslog_input, \
   udp_ports are used in the rsyslog config and tcp_ports are dropped. \
   If both udp_ports and tcp_ports are not configured, \
   it is default to 'tcp_ports: [514]'. #}
{% if __rsyslog_input.udp_ports | d([]) %}
# Read messages sent over UDP
module(load="imudp" threads="{{ logging_udp_threads }}"
       TimeRequery="{{ logging_udp_system_time_requery }}"
       BatchSize="{{ logging_udp_batch_size }}")
{% else %}
{%   if not __rsyslog_input.tls | d(false) | bool %}
# Read messages sent over plain TCP
module(load="imptcp" threads="{{ logging_tcp_threads }}")
{%   else %}
# Read messages sent over TCP with TLS
module(load="imtcp"
       StreamDriver.Name="{{ __rsyslog_tls_netstream_driver }}"
       StreamDriver.Mode="1"
       StreamDriver.AuthMode="{{ __rsyslog_input.pki_authmode |
	                             d(__rsyslog_default_pki_authmode) }}"
{%     if __rsyslog_input.pki_authmode | d() != 'anon' %}
{%       if __rsyslog_input.permitted_clients | d() %}
       PermittedPeer=["{{ __rsyslog_input.permitted_clients | join('","') }}"]
{%       else %}
       PermittedPeer=["*.{{ logging_domain }}"]
{%       endif %}
{%     endif %}
)
{%   endif %}
{% endif %}
