So, I use Simple Event Correlator to notify me of interesting events in life of my router friends. Here, for example, sec template to send me email with syslog line in the body when somebody tries to go to configuration mode and execute certain commands:
type=Single ptype=RegExp pattern=.*cmd=(configure|clear|ip|no|interface|switchport|router|spanning-tree) desc=$0 action=pipe '$0' /usr/bin/mail -s "router/switch config change is happening right now" noc@example.com
You need to put this template into SEC configuration file and tell it were to look for these messages:
sec -detach -conf=/etc/sec-tacacs.conf -input=/var/log/tac-plus/account
In this case it's TACACS+ log file, so you need to configure a router to report such activities:
aaa new-model
aaa authentication login default group tacacs+ none
aaa authentication enable default group tacacs+ none
aaa authorization exec default group tacacs+ none
aaa authorization commands 15 default group tacacs+ none
aaa accounting commands 15 default start-stop group tacacs+
tacacs-server host <server ip>
tacacs-server <key>
Here is another template to report all syslog messages coming from devices with loopback interface IP address in the range 10.9.20.0/24 or 10.9.25.0/24. Why loopback? See my previous post.
type=Single ptype=RegExp pattern=(.*)10\.9\.2[0|5]\.(.*)%[A-Z]* desc=$0 action=pipe '$0' /usr/bin/mail -s " router syslog message" noc@example.com