-
Notifications
You must be signed in to change notification settings - Fork 790
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
Add syslog forwarding rules validation and thread exception handling #17572
base: master
Are you sure you want to change the base?
Conversation
Add validation of rsyslog message from conf file like telemetry, bgp, gnmi, etc. Implement thread-safe exception handler for subthread error capture Enhance logging message generation for comprehensive testing Tested: Ran all test cases in test_syslog_source_ip.py
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
537deea
to
ec5e1e8
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Related image change sonic-net/sonic-buildimage#21923 |
time.sleep(0.2) | ||
for flag, msg in logging_data: | ||
for i in range(syslogUtilsConst.PACKETS_NUM): | ||
dut.shell(f"logger {default_priority} {flag} {msg} {i + 1}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command run in host.
However, the config causes this issue are:
'''
if re_match($programname, "bgp[0-9]*#(frr|zebra|staticd|watchfrr)") then {
/var/log/frr/zebra.log
stop
}
'''
Which means when reproduce the issue, the log send inside bgp docker container, then the 'programname' part can match.
I warry about this test case can't prevent regression. can you test with an image have this issue to make sure this test can catch issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good suggestion: test with an image have this issue to make sure this test can catch issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with an image that had the configuration issue, and the test failed and reporting that not all types of forwarded messages were successful.
Hi @ytzur1, I manually ran your test changes from our test server and seeing following issues when running the testcase. Can you please double check your logic in capture_syslog_packets() function in syslog/syslog_utils.py 25/03/2025 23:13:49 base._run L0108 DEBUG | /var/src/sonic-mgmt-int/tests/syslog/syslog_utils.py::capture_syslog_packets#157: AnsibleModule::fetch Result => {"failed": true, "msg": "file not found: /tmp/test_syslog_tcpdump_Vrf-data.pcap", "invocation": {"module_args": {"src": "/tmp/test_syslog_tcpdump_Vrf-data.pcap"}}, "_ansible_no_log": false, "changed": false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check logic for capture_syslog_packets, seems to run into "file not found: /tmp/X.pcap" issue
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
501acf4
to
e1ed921
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Hi, @zbud-msft
|
@ytzur1 Would it be possible to post screenshot of testcases passing since kvm tests will skip? |
Add validation of rsyslog message from conf file like telemetry, bgp, gnmi, etc.
Implement thread exception handler for sub thread error capture
Description of PR
Summary:
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
The current syslog testing framework lacks validation of rsyslog messages from various configuration files. Additionally, exception during subthreads were not being caught by the main thread.
How did you do it?
Added rsyslog message validation:
Implemented thread-safe exception handling:
How did you verify/test it?
Ran all test cases in test_syslog_source_ip.py
Any platform specific information?
No
Supported testbed topology if it's a new test case?
No
Documentation