Skip to content

[202305][rsyslog]: Remote logging with the highest rule priority #21993

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

Merged
merged 3 commits into from
May 6, 2025
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
56 changes: 28 additions & 28 deletions files/image_config/rsyslog/rsyslog.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,6 @@ template(name="WelfRemoteFormat" type="string" string="%TIMESTAMP% id=firewall t
:::date-year%-%timereported:::date-month%-%timereported:::date-day% %timereported:::date-hour%:%timereported:::date-minute%:%timereported\
:::date-second%\" fw=\"{{ fw_name }}\" pri=%syslogpriority% msg=\"%syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\"\n")

#
# Set the default permissions for all log files.
#
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf

#
# Suppress duplicate messages and report "message repeated n times"
#
$RepeatedMsgReduction on

###############
#### RULES ####
###############

#
# Remote syslog logging
#
Expand Down Expand Up @@ -128,3 +100,31 @@ $RepeatedMsgReduction on
*.{{ severity }}
action(type="omfwd" Target="{{ server }}" Port="{{ port }}" Protocol="{{ proto }}" Template="{{ template }}"{{ options }})
{% endfor %}

#
# Set the default permissions for all log files.
#
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf

#
# Suppress duplicate messages and report "message repeated n times"
#
$RepeatedMsgReduction on

###############
#### RULES ####
###############
2 changes: 2 additions & 0 deletions src/sonic-config-engine/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[aliases]
test=pytest
5 changes: 2 additions & 3 deletions src/sonic-config-engine/tests/test_cfggen_from_yang.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ def test_portchannel_table(self):
assert(output == \
{'PortChannel1001': {'admin_status': 'up',
'lacp_key': 'auto',
'members': ['Ethernet0', 'Ethernet4'],
'min_links': '1',
'mtu': '9100'},
'PortChannel1002': {'admin_status': 'up',
'lacp_key': 'auto',
'members': ['Ethernet16', 'Ethernet20'],
'min_links': '1',
'mtu': '9100'}})

Expand Down Expand Up @@ -194,7 +192,8 @@ def test_acl_rule(self):
"EVERFLOW|Rule2": {
"DST_IP": "192.169.10.1/32",
"SRC_IP": "10.10.1.1/16",
"IP_TYPE": "IPV4"
"IP_TYPE": "IPV4",
"PRIORITY": "101"
}
})

Expand Down
11 changes: 2 additions & 9 deletions src/sonic-config-engine/tests/test_yang_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,13 @@
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"members": [
"Ethernet0",
"Ethernet4"
],
"min_links": "1",
"mtu": "9100",
"lacp_key": "auto",
"name": "PortChannel1001"
},
{
"admin_status": "up",
"members": [
"Ethernet16",
"Ethernet20"
],
"min_links": "1",
"mtu": "9100",
"lacp_key": "auto",
Expand Down Expand Up @@ -300,7 +292,8 @@
"DST_IP": "192.169.10.1/32",
"SRC_IP": "10.10.1.1/16",
"IP_TYPE": "IPV4",
"RULE_NAME": "Rule2"
"RULE_NAME": "Rule2",
"PRIORITY": 101
}
]
}
Expand Down
Loading