Skip to content

[pretest] remove older logs from /var/log/ for better log_analyzer analysis#3670

Merged
vaibhavhd merged 2 commits intosonic-net:masterfrom
vaibhavhd:remove-old-logs
Jul 14, 2021
Merged

[pretest] remove older logs from /var/log/ for better log_analyzer analysis#3670
vaibhavhd merged 2 commits intosonic-net:masterfrom
vaibhavhd:remove-old-logs

Conversation

@vaibhavhd
Copy link
Copy Markdown
Contributor

Description of PR

Summary: Remove more than one day logs from /var/log dir inside DUT.
Fixes # (issue)

Type of change

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

Back port request

  • 201911

Approach

What is the motivation for this PR?

Before tests, some DUTs can have much older files which are not removed as part of present cleanup steps.
These files lead to issues with log_analyzer processing. Examples include backup files and user created debug files:

/var/log/swss/sairedis.rec.1.gz-2021031300.backup

How did you do it?

Added an extra step for files cleanup as part of test_pretest::test_cleanup_testbed

How did you verify/test it?

With modification, the backup and older files are removed from /var/log dir

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@vaibhavhd vaibhavhd requested a review from a team as a code owner June 15, 2021 21:44
Copy link
Copy Markdown
Collaborator

@wangxin wangxin left a comment

Choose a reason for hiding this comment

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

Manually run the command got error:

admin@vlab-01:~$ sudo find /var/log/ -mtime +1 '*.gz' | sudo xargs rm -f
find: paths must precede expression: `*.gz'

Can you check?

@vaibhavhd
Copy link
Copy Markdown
Contributor Author

Manually run the command got error:

admin@vlab-01:~$ sudo find /var/log/ -mtime +1 '*.gz' | sudo xargs rm -f
find: paths must precede expression: `*.gz'

Can you check?

Fixed now, thanks! There indeed was an error that likely was masked by module_ignore_errors=True. I never intended to only remove *.gz files as part of this new command. That part is already covered by first step.

@vaibhavhd vaibhavhd requested a review from wangxin July 13, 2021 22:42
@vaibhavhd vaibhavhd merged commit 9b47880 into sonic-net:master Jul 14, 2021
@vaibhavhd vaibhavhd deleted the remove-old-logs branch July 14, 2021 16:18
vmittal-msft pushed a commit to vmittal-msft/sonic-mgmt that referenced this pull request Sep 28, 2021
…alysis (sonic-net#3670)

Remove more than one day logs from /var/log dir inside DUT.
Before tests, some DUTs can have much older files which are not removed as part of present cleanup steps.
These files lead to issues with log_analyzer processing. Added an extra step for files cleanup as part of test_pretest::test_cleanup_testbed
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