You will want to look into using logmon for this. There is a command mode where instead of just parsing a log file, it executed a script and parses what is sent to standard out. With this functionality you can pretty much achieve any desired functionality (within reason of course).
I'd also suggest that it might be worth the effort to see if the functionality in your script(s) isn't already in the product - often times it is or it's there in an easier form to get at.
-Garin