I am a newby to this but I am tasked at writing a tcl script. The script is to print a message on the command line "Warning, system error detected" when a syslog system_error is found.
Now I am completely new to tcl and all I know is that an event_register_syslog needs to be used. Other than that I am completely in the dark and do not know where to go or start.
There are no GUIs needed just the CLI.
Any help and support would be much appreciated.
here is a bit of code that should get you started:
#set result variable equal to contents of syslog
set result [exec puts syslog]
#parse syslog line by line searching for error
foreach line [string trim [split $result "\n"]] {
#regex the error string
if {[regexp {Whatever Error Massage may look like!}]} {
puts "Warning, system error detected"
}
Here are some useful regex links for tcl: