Cisco TCL scripting is truly a dark art. While TCL is well-described and the Cisco tome on the subject is quite verbose, the examples provided in those documents skip over the much needed simpler examples to get started with.
This directory has a collection of scripts that work with the Embedded Event Manager.
This directory has a collection of scripts that work with the Embedded Syslog Manager in Cisco IOS and IOS-XE.