diff --git a/doc/Command-Reference.md b/doc/Command-Reference.md index a4d49e6c811d..92f104e9aedd 100644 --- a/doc/Command-Reference.md +++ b/doc/Command-Reference.md @@ -2959,6 +2959,7 @@ This sub-section explains the show commands for displaying the running configura 5) all 6) acl 7) ports +8) syslog **show runningconfiguration all** @@ -3012,6 +3013,24 @@ This command displays the running configuration of the ntp module. admin@sonic:~$ show runningconfiguration ntp ``` +**show runningconfiguration syslog** + +This command displays the running configuration of the syslog module. + + - Usage: + show runningconfiguration syslog + + +- Example: + ``` + admin@str-s6000-acs-11:~$ show run syslog + Syslog Servers + ---------------- + 4.4.4.4 + 5.5.5.5 + ``` + + **show runningconfiguration snmp** This command displays the running configuration of the snmp module. diff --git a/show/main.py b/show/main.py index 7fb47310e19d..bcd7b724fbf4 100755 --- a/show/main.py +++ b/show/main.py @@ -1480,6 +1480,24 @@ def ntp(verbose): run_command(cmd, display_cmd=verbose) +# 'syslog' subcommand ("show runningconfiguration syslog") +@runningconfiguration.command() +@click.option('--verbose', is_flag=True, help="Enable verbose output") +def syslog(verbose): + """Show Syslog running configuration""" + syslog_servers = [] + syslog_dict = {} + with open("/etc/rsyslog.conf") as syslog_file: + data = syslog_file.readlines() + for line in data: + if line.startswith("*.* @"): + line = line.split(":") + server = line[0][5:] + syslog_servers.append(server) + syslog_dict['Syslog Servers'] = syslog_servers + print tabulate(syslog_dict, headers=syslog_dict.keys(), tablefmt="simple", stralign='left', missingval="") + + # # 'startupconfiguration' group ("show startupconfiguration ...") #