First of all, I'd like to thank Amine Moulay Ramdane, who programmed the AdvNotify PPM package. AdvNotify provides the functions needed to monitor directories and report when changes are made to these directories. I practically used the example file she provides with it and made some modifications in order to capture data and redirect it. Here's how LogAgent works:
@mondir is the list of directories containing the log files that you want to monitor. If one folder contains more than one log file, it is not necessary to specify each one of them, specifying the folder will catch them all.
$mainlog is the central destination where you want to redirect all your log files, in UNC format.
Then we start one thread for each element contained in the list @mondir. After the thread is started, we have to enable each one of them with EnableWatch(). Then, the program goes into an infinite loop in which it waits for changes to happen in the folders it monitors. When data is added to a log file, it is also captured by LogAgent and then it sends it back to the central log file. If we get out of the loop (with [CRTL-C]), then we terminate all the threads we previously created.
If the applications that you are monitoring don't provide username, IP or host name information, this doesn't do you any good. You could probably use the commodities provided in Perl to add this feature to LogAgent (if you do it, send me the code - thanks!).
In the likely event that you don't want to install Perl on all your networked PCs, you can use perl2exe.exe to convert your Perl scripts to an executable .EXE file. With the full version, you can even add -gui option in order to prevent the console from showing, thus making LogAgent run in the background without being seen by the user.
ActivePerl can be downloaded from www.activestate.com
Perl2exe (demo) can be downloaded from www.indigostar.com
2. The source code
Table of contents