Skip to content

[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#884
wangxin wants to merge 1 commit intosonic-net:masterfrom
wangxin:loganalyzer-flush

Conversation

@wangxin
Copy link
Copy Markdown
Collaborator

@wangxin wangxin commented Apr 23, 2019

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

  • Bug fix
  • [] Testbed and Framework(new/improvement)
  • [] Test case(new/improvement)

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

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>
Copy link
Copy Markdown
Contributor

@stepanblyschak stepanblyschak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this change is needed

do_copy = True
if do_copy:
fp.write(line)
fp.flush()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@wangxin
Copy link
Copy Markdown
Collaborator Author

wangxin commented Apr 24, 2019

@stepanblyschak Thanks for your comments. You are right. I am closing this PR.

@wangxin wangxin closed this Apr 24, 2019
@wangxin wangxin deleted the loganalyzer-flush branch May 24, 2019 03:32
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants