Creating the Logs and Calling the Script
The first thing I have is a batch script that calls Log Parser and puts everything on the central storage location:
This script is run every night from task scheduler on the computer we�re trying to collect logs from. In my case, I had this set up on about 30 servers. However, the script was actually stored on the central server so that if I needed to make a change, I just did it in one place, instead of having to update all 30 systems.
The first line sets a date variable used for naming the files. It�s in the form yyyymmdd. The next three lines call Log Parser. Log Parser is a tool from Microsoft used to query various Windows log files. The query syntax is SQL based. I wanted to get the previous days logs so I used the BETWEEN statements. I retrieved information from the following:
- Non-information events from the Application log (warnings and errors).
- Unsuccessful login events from the Security log.
-
IIS 6 errors from the HTTPERR log.
The last line is where we call our VBScript. I�ll start by explaining the functions and then we�ll look at the script as a whole.