Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ssip]: Update config generator #10991

Merged
merged 4 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions files/image_config/rsyslog/rsyslog.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ $UDPServerRun 514
$template SONiCFileFormat,"%timegenerated%.%timegenerated:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
$ActionFileDefaultTemplate SONiCFileFormat

#Set remote syslog server
{% for server in SYSLOG_SERVER %}
*.* @[{{ server }}]:514;SONiCFileFormat
{% endfor %}

#
# Set the default permissions for all log files.
#
Expand Down Expand Up @@ -72,3 +67,30 @@ $RepeatedMsgReduction on
###############
#### RULES ####
###############

#
# Remote syslog logging
#

# The omfwd plug-in provides the core functionality of traditional message forwarding via UDP and plain TCP.
# It is a built-in module that does not need to be loaded.

{% if SYSLOG_SERVER is defined %}
nazariig marked this conversation as resolved.
Show resolved Hide resolved
{% for server, data in SYSLOG_SERVER.items() %}
{% set params_list = [] %}
{% if 'source' in data %}
nazariig marked this conversation as resolved.
Show resolved Hide resolved
{% set dummy = params_list.append('address=' + '"' + data.source|string + '"') %}
{% endif %}
{% if 'port' in data %}
{% set dummy = params_list.append('port=' + '"' + data.port|string + '"') %}
{% endif %}
{% if 'vrf' in data and data['vrf'] != "default" %}
{% set dummy = params_list.append('device=' + '"' + data.vrf|string + '"') %}
{% endif %}
{% if params_list %}
*.* action(type="omfwd" target="{{ server }}" protocol="udp" {{ params_list|join(' ') }} template="SONiCFileFormat")
{% else %}
*.* action(type="omfwd" target="{{ server }}" protocol="udp" template="SONiCFileFormat")
{% endif %}
{% endfor %}
{% endif %}
2 changes: 1 addition & 1 deletion src/sonic-utilities