From e4e3adcbc2b47174e2ccfb307f6258ba3cd26b04 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Wed, 20 Jul 2022 10:05:13 +0300 Subject: [PATCH] [ssip]: Update config generator (#10991) - Why I did it To implement Syslog Source IP feature In order to include the following commit: 8e5d478 [ssip]: Add CLI (#2191) - How I did it Updated syslog config template Advanced submodule sonic-utilities ea11b22 [sonic-bootchart] add sonic-bootchart (#2195) 8e5d478 [ssip]: Add CLI (#2191) 1dacb7f Replace pyswsssdk with swsscommon (#2251) - How to verify it make configure PLATFORM=mellanox make target/sonic-mellanox.bin Signed-off-by: Nazarii Hnydyn --- files/image_config/rsyslog/rsyslog.conf.j2 | 32 ++++++++++++++++++---- src/sonic-utilities | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 index 37410293a4..5db3ec86b7 100644 --- a/files/image_config/rsyslog/rsyslog.conf.j2 +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -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. # @@ -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 %} +{% for server, data in SYSLOG_SERVER.items() %} +{% set params_list = [] %} +{% if 'source' in data %} +{% 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 %} diff --git a/src/sonic-utilities b/src/sonic-utilities index d6b886989c..ea11b22f59 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit d6b886989cc1f2104613c2cb21d406f9ab5127dc +Subproject commit ea11b22f596fb90c2d85cc27c0f73b50039a42ad