Syslog monitor

Hi ALL. I need to monitor some phrase in syslog (for example “device changed”) and once it found, send SMS via USB modem. So how can i monitor RB`s syslog using script?

:put [/log find where message~“device changed”]

:put /log find where message~“device changed” do={
/tool sms send usb1 “XXXXXXXXX” \ message=“WARNING”
}

Does not work.

Is like you do not know how scripting…

It’s only one hint how write new script.

Use my hint ahd find on the forum using search function the already present solutions.

Looks like you misspelled too. :slight_smile: Working script is:

:foreach i in=[/log find where message~"device changed"] do={
  /tool sms send usb1 "XXXXXXXXX" \ message="WARNING"
}

Anyway thanks.

I do not misspelled anything.

:put [/log find where message~“device changed”]

simply print one list of ID of each finded log.

Thinking you know srcripting, I’m aspect you to simple put the “getting” part ([/log find where message~“device changed”]) on “foreach”…

Like what you have done now.

BUT OBVIOUSLY IF YOU DO NOT CHECK WHAT IS THE LAST LOG YOU HAVE SENT, YOU CONTINUOSLY RECEIVE THE SAME WARNING ON EACH SCRIPT RUN…

And is why I suggest you to use search function…

If i would know scripting, i wouldn`t post this thread.

Probably, i will edit the scipt so it will delete it`s own shedule once the first SMS sent.