[logAnalyzer] Flush after extracted logs#884
Closed
wangxin wants to merge 1 commit intosonic-net:masterfrom
wangxin:loganalyzer-flush
Closed
[logAnalyzer] Flush after extracted logs#884wangxin wants to merge 1 commit intosonic-net:masterfrom wangxin:loganalyzer-flush
wangxin wants to merge 1 commit intosonic-net:masterfrom
wangxin:loganalyzer-flush
Conversation
This is to ensure that the end marker is put after all the extracted logs, usually in /tmp/syslog Change-Id: Ie4b450b3128fde72699af97a7d02e5dad28032ff Signed-off-by: Xin Wang <xinw@mellanox.com>
stepanblyschak
requested changes
Apr 23, 2019
Contributor
stepanblyschak
left a comment
There was a problem hiding this comment.
I don't think this change is needed
| do_copy = True | ||
| if do_copy: | ||
| fp.write(line) | ||
| fp.flush() |
Contributor
There was a problem hiding this comment.
Why do we need to do flush here? with open(target_filename, 'w') as fp: closes the file at the end of with block which means it will flush before close
Collaborator
Author
|
@stepanblyschak Thanks for your comments. You are right. I am closing this PR. |
deerao02
pushed a commit
to deerao02/sonic-mgmt
that referenced
this pull request
Dec 18, 2025
…opologies (sonic-net#884) …ing topologies: o t0-isolated-d256u256s2 o t0-isolated-d128u128s2 o t0-isolated-d16u16s2 o t0-isolated-d32u32s2 <!-- Please make sure you've read and understood our contributing guidelines; https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md Please provide following information to help code review process a bit easier: --> ### Description of PR <!-- - Please include a summary of the change and which issue is fixed. - Please also include relevant motivation and context. Where should reviewer start? background context? - List any dependencies that are required for this change. --> Summary: Use the "tor" role for all pt0 peers in t0-isolated topologies, and update the topology generator script to assign this role. ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [ ] Bug fix - [x] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202205 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 ### Approach #### What is the motivation for this PR? While developing another testbed enhancement involving the peer devices and configuration of t0-isolated and t0-isolated-v6 topologies, it was noticed that the topology definitions for t0-isolated-d16u16s2, t0-isolated-d32u32s2, t0-isolated-d128u128s2, and t0-isolated-d256u256s2, and their v6 counterparts, do not specify that pt0 peers use configuration for the "tor" role. This distinction proved beneficial for the convergence of peer docker containers (more on that to come in future PRs), and also brought the models defined with these topologies in-line with the definition for t0-isolated-d2u510s2. The topology generator script is also modified such that future t0-isolated topologies will specify the "tor" role for pt0 peers in the future. #### How did you verify/test it? Ran multiple full suites with this change and did not see any regressions due to this change. #### Any platform specific information? None #### Supported testbed topology if it's a new test case? N/A
kazinator-arista
pushed a commit
to kazinator-arista/sonic-mgmt
that referenced
this pull request
Mar 4, 2026
[Vxlan] : adding show vnet/vxlan cmds (sonic-net#880) [show][bgp] Use only 'show ip bgp' as the base and use bgp_frr_v4 file for FRR routing stack (sonic-net#884) [fast reboot] set a fast-reboot DB flag (sonic-net#887) [show] Add 'ip/ipv6 bgp network' commands (sonic-net#888)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
Summary:
Fixes # (issue)
Log analyzer extracts logs starting from the start_marker to /tmp/syslog. This is done by the ansible/roles/library/extract_log.py module. Then log analyzer will write an end_marker into /tmp/syslog and analyze the content between start&end markers. Ocassionally, the end marker is not written to the end of /tmp/syslog. This caused some key logs are not in the range of start and end marker.
Possible reason is that the extract_log module does not do flush operation after write content to /tmp/syslog.
The change is to add a flush operation to the extract_log module after all the lines are written to /tmp/syslog.
Type of change
Approach
How did you do it?
Add a flush operation to the extract_log module after all the lines are written to /tmp/syslog.
How did you verify/test it?
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation