-
Notifications
You must be signed in to change notification settings - Fork 667
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 sonic-clear logging command #3151
base: master
Are you sure you want to change the base?
Add sonic-clear logging command #3151
Conversation
Signed-off-by: mati <mati@marvell.com>
Signed-off-by: mati <mati@marvell.com>
@mihirpat1 would you be able to review? |
@cli.command() | ||
def logging(all): | ||
"""Clear logging files""" | ||
if os.path.exists("/var/log.tmpfs"): |
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.
Do we not plan to delete existing logs in /var/log/
if both the directories /var/log/
and /var/log.tmpfs/
have syslogs?
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.
Yes, thanks.
Signed-off-by: matiAlfaro <mati@marvell.com>
clear/main.py
Outdated
@cli.command() | ||
def logging(all): | ||
"""Clear logging files""" | ||
log_path_arr = ["/var/log"] |
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.
Can we put a check here to ensure /var/log
directory exists before setting log_path_arr
?
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.
done
Signed-off-by: matiAlfaro <mati@marvell.com>
###What I did
Added command
sonic-clear logging - delete syslog & syslog.1
sonic-clear logging -a/--all - delete syslog* files
###How I did it
Equivalent to "show logging" command, working on files at /var/log or at /var/log.tmpfs
delete relevant syslog* files
###How to verify it
clear logging when no syslog files exist
clear logging when only syslog file exist
clear logging when syslog & syslog.1 files exits
clear logging when syslog, syslog.1 and syslog2.gz files exits
Repeat 1-4 with
Clear logging --all
verify also that show logging behave correctly after clear
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)