Skip to content
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

[config] Add commands for adding/removing syslog servers #609

Merged
merged 5 commits into from
Aug 19, 2019

Conversation

tsvanduyn
Copy link
Contributor

@tsvanduyn tsvanduyn commented Aug 15, 2019

- What I did
I've added config commands to add/del syslog servers from the device.

- How I did it

admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ redis-cli -n 4 keys "*" | grep syslog  -i
SYSLOG_SERVER|100.127.20.21
SYSLOG_SERVER|10.3.145.8
SYSLOG_SERVER|4.4.4.4
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ sudo config syslog add 5.5.5.5
Syslog server 5.5.5.5 added to configuration
Restarting rsyslog-config service...
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ redis-cli -n 4 keys "*" | grep syslog  -i
SYSLOG_SERVER|100.127.20.21
SYSLOG_SERVER|10.3.145.8
SYSLOG_SERVER|4.4.4.4
SYSLOG_SERVER|5.5.5.5
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ sudo config syslog del 5.5.5.5
Syslog server 5.5.5.5 removed from configuration
Restarting rsyslog-config service...
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ redis-cli -n 4 keys "*" | grep syslog  -i
SYSLOG_SERVER|100.127.20.21
SYSLOG_SERVER|10.3.145.8
SYSLOG_SERVER|4.4.4.4
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ 

- How to verify it

There are two ways: 
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ redis-cli -n 4 keys "*" | grep syslog  -i
SYSLOG_SERVER|100.127.20.21
SYSLOG_SERVER|10.3.145.8
SYSLOG_SERVER|4.4.4.4

Or 
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ show run all | grep -i syslog -A4
    "SYSLOG_SERVER": {
        "4.4.4.4": {}, 
        "10.3.145.8": {}, 
        "100.127.20.21": {}
    }, 
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ sudo config syslog add 5.5.5.5
Syslog server 5.5.5.5 added to configuration
Restarting rsyslog-config service...
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ show run all | grep -i syslog -A4
    "SYSLOG_SERVER": {
        "4.4.4.4": {}, 
        "5.5.5.5": {}, 
        "10.3.145.8": {}, 
        "100.127.20.21": {}
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ 

- Previous command output (if the output of a command-line utility has changed)
There was no previous command to add or remove syslog servers.
- New command output (if the output of a command-line utility has changed)

config add syslog command:
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ sudo config syslog add 5.5.5.5
Syslog server 5.5.5.5 added to configuration
Restarting rsyslog-config service...
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$

config del syslog command: 
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ sudo config syslog del 5.5.5.5
Syslog server 5.5.5.5 removed from configuration
Restarting rsyslog-config service...
admin@str-s6000-acs-11:/usr/lib/python2.7/dist-packages/config$ 

-->

config/main.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

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

@tsvanduyn: Can you please also update the Command Reference Guide (https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md) to add these commands in this PR? I forgot to ask this of you with your previous DHCCP Relay destination change. I would like you to open a separate PR to add those commands later, also.

doc/Command-Reference.md Outdated Show resolved Hide resolved
doc/Command-Reference.md Outdated Show resolved Hide resolved
doc/Command-Reference.md Outdated Show resolved Hide resolved
@jleveque
Copy link
Contributor

Retest this please

@jleveque jleveque changed the title [config] command add/remove syslog servers [config] Add commands for adding/removing syslog servers Aug 19, 2019
@jleveque jleveque merged commit 07bd868 into sonic-net:master Aug 19, 2019
#
@config.group()
@click.pass_context
def syslog(ctx):
Copy link
Collaborator

@stephenxs stephenxs Sep 7, 2019

Choose a reason for hiding this comment

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

@jleveque @tsvanduyn
It seems that the function name "syslog" conflicts with the module "syslog", causing functions calling logxxx failed, like "config load_minigraph".
Is it possible to rename it, like "logserver"?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@stephenxs / @jleveque the ticket: #635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants