-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1861318 - [logging role] cannot setup machine with tls
In the server configuration (remote input), the description of udp_ports and tcp_ports was not accurate. Added the followings - If both are set, udp_ports is used and tcp_ports is dropped. - If both are not set, "tcp_ports: [514]" is added. - I.e., udp_ports do not have a default value; tcp_ports do "[514]". The templates input_remote.j2 and input_remote_module.j2 are updated based on the description.
- Loading branch information
Showing
3 changed files
with
63 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,51 @@ | ||
{# If both udp_ports and tcp_ports appear in the item, \ | ||
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 item.udp_ports | d([]) %} | ||
# Log messages from remote hosts over UDP | ||
{% set __logging_loop_index = loop.index %} | ||
input(name="{{ item.name }}" type="imudp" port=["{{ item.udp_ports | join('","') }}"]) | ||
{{ lookup('template', 'input_template.j2') }} | ||
{% endif %} | ||
{% set rsyslog_flows = logging_flows | d([ {"name": "default_flow", "inputs": [ item.name ], "outputs": ["default_files"]} ], true) %} | ||
{% set outdict = {} %} | ||
{% for flow in rsyslog_flows %} | ||
{% if flow.inputs | intersect([ item.name ]) %} | ||
{% for oname in flow.outputs %} | ||
{% set _ = outdict.__setitem__(oname, outdict.get(oname,[])|union([ item.name ])) %} | ||
{% endfor %} | ||
{% else %} | ||
{% if not item.tcp_ports | d([]) %} | ||
{% set item_tcp_ports = ["514"] %} | ||
{% else %} | ||
{% set item_tcp_ports = item.tcp_ports %} | ||
{% endif %} | ||
{% endfor %} | ||
{% for tport in item.tcp_ports | d([]) %} | ||
{% set __logging_loop_index = loop.index %} | ||
{% if not item.tls | d(false) | bool %} | ||
{% set rsyslog_flows = logging_flows | d([ {"name": "default_flow", "inputs": [ item.name ], "outputs": ["default_files"]} ], true) %} | ||
{% set outdict = {} %} | ||
{% for flow in rsyslog_flows %} | ||
{% if flow.inputs | intersect([ item.name ]) %} | ||
{% for oname in flow.outputs %} | ||
{% set _ = outdict.__setitem__(oname, outdict.get(oname,[])|union([ item.name ])) %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
{% for tport in item_tcp_ports %} | ||
{% set __logging_loop_index = loop.index %} | ||
{% if not item.tls | d(false) | bool %} | ||
# Log messages from remote hosts over plain TCP | ||
input(name="{{ item.name }}_{{ __logging_loop_index }}" type="imptcp" port="{{ tport }}") | ||
{% else %} | ||
{% else %} | ||
# Log messages from remote hosts over TLS | ||
input(name="{{ item.name }}_{{ __logging_loop_index }}" type="imtcp" port="{{ tport }}") | ||
{% endif %} | ||
{% for output in rsyslog_outputs %} | ||
{% if outdict[output.name] | d(false) %} | ||
{% endif %} | ||
{% for output in rsyslog_outputs %} | ||
{% if outdict[output.name] | d(false) %} | ||
if | ||
{% for inputname in outdict[output.name] %} | ||
{% if inputname == item.name %} | ||
{% if not loop.first %} | ||
{% for inputname in outdict[output.name] %} | ||
{% if inputname == item.name %} | ||
{% if not loop.first %} | ||
or | ||
{% endif %} | ||
{% endif %} | ||
($inputname == "{{ item.name }}_{{ __logging_loop_index }}" ) | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
then { | ||
call {{ output.name }} | ||
} | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters