cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1275
Views
0
Helpful
3
Replies

ASR9K | Script to generate a syslog messages of commands whenever confiugration changes made

We have ASR9K Platform, and using 5.1.3 SP3 and using the below script where the requirment is fullfiled of logs getting generated on the syslog server and show log, but with that below logs are also getting printed. Need to understand how do we avoid this extra logs printing.

             RP/0/RSP0/CPU0:Mar 21 18:02:11.389 IST: syslog_dev[92]: noscan:     while executing

             RP/0/RSP0/CPU0:Mar 21 18:02:11.389 IST: syslog_dev[92]: noscan: "close $fd"

             RP/0/RSP0/CPU0:Mar 21 18:02:11.389 IST: syslog_dev[92]: noscan:     (file "/dev/rdsfs/etc/eem_rdsfs/commit_syslog.tcl" line 10)

::cisco::eem::event_register_syslog pattern "%MGBL-CONFIG-6-DB_COMMIT : Configuration committed by user" maxrun_sec 600\
\
#\
# errorInfo gets set by namespace if any of the auto_path directories do not\
# contain a valid tclIndex file.  It is not an error just left over stuff.\
# So we set the errorInfo value to null so that we don't have left\
# over errors in it.\
#\
set errorInfo ""\
\
\
namespace import ::cisco::eem::*\
namespace import ::cisco::lib::*\
\
#\
# errorInf gets set by namespace if any of the auto_path directories do not\
# contain a valid tclIndex file.  It is not an error just left over stuff.\
# So we set the errorInfo value to null so that we don't have left\
# over errors in it.\
#\
set errorInfo ""\
#Notify users that we're collecting\
set output_msg "Collecting commit configuration"\
\
#query the event info\
array set arr_einfo [event_reqinfo]\
\
if \{$_cerrno != 0\} \{\
    set result [format "component=%s; subsys err=%s; posix err=%s;\\n%s" \\\
        $_cerr_sub_num $_cerr_sub_err $_cerr_posix_err $_cerr_str]\
    error $result\
\}\
\
#Extract the message from the event info and append it to the email body\
set syslog_msg $arr_einfo(msg)\
\
\
#Extract the location of the message:\
set location ""\
set output_msg "xyz"\
\
regexp \{.*show configuration commit changes ([0-9]*).*\}  $syslog_msg match commit_id\
\
set output_msg "xyz" \
\
#open a cli connection\
\
if [catch \{cli_open\} result] \{\
    error $result $errorInfo\
\} else \{\
    array set cli1 $result\
\}\
set show_cmd "show config commit changes $commit_id"\
if [catch \{cli_exec $cli1(fd) $show_cmd\} result] \{\
error $result $errorInfo\
\}\
action_syslog priority info msg $result\
\
#close the cli connection\
if [catch \{cli_close $cli1(fd) $cli1(tty_id)\} result] \{\
    error $result $errorInfo\
\}\

1 Accepted Solution

Accepted Solutions

Philip D'Ath
VIP Alumni
VIP Alumni

Have you considered using a free tool like RANCID?

View solution in original post

3 Replies 3

Philip D'Ath
VIP Alumni
VIP Alumni

Have you considered using a free tool like RANCID?

 haven't tried this tool, and i doubt it will be allowed to be implement the same by customer.

Hi

any one who knows how to avoid this logs ?