WhoKilledKenny
MIS
strebor (TechnicalUser)
26 Jun 06 10:56
You may be interested in Log Parser 2.2, free from Microsoft, is a really good tool for accessing and reporting on log files, including event logs. It can be used as a command line tool or called and used from a script (vbscript, etc.) or a programming language such as c#. You can easily construct sql-like queries... more at:
strebor,
I like the product and I have tested it getting remote Event log errors(FROM \\Fileserver\System). Works Great...
In my VBScript I have an arrComputers (array) created via a text file. How would I allow the SELECT Query in LogParser to enclude the server name in the FROM_Entity
Example: FROM \\Servername\System, but instead of manually entering in every server name it reads it from arrComputers.
If anyone knows please reply, looking at the Log Parser Forum for the answer.
Here is the VB Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\Scripts\Server.txt", ForReading)
strText = objTextFile.ReadAll
objTextFile.Close
arrComputers = Split(strText, VbCrLf)
For Each strComputer In arrComputers
Set objLogQuery = CreateObject("MSUtil.LogQuery")
Set objEVTInputFormat = CreateObject("MSUtil.LogQuery.EventLogInputFormat")
objEVTInputFormat.direction = "BW"
Set objNATOutputFormat = CreateObject("MSUtil.LogQuery.NativeOutputFormat")
objNATOutputFormat.rtp = -1
strQuery = "SELECT TimeWritten AS TIME, EventTypeName AS EVENT, EventID, TO_UPPERCASE( EXTRACT_PREFIX(Message, 4, ' ') ) AS DESCRIPTION FROM \\hpmidb1\System WHERE ( EventTypeName = 'Error event') AND TimeWritten >= SUB ( TO_LOCALTIME(SYSTEM_TIMESTAMP()), TIMESTAMP('0000-01-05', 'yyyy-MM-dd') )"
objLogQuery.ExecuteBatch strQuery, objEVTInputFormat, objNATOutputFormat
Next
26 Jun 06 10:56
You may be interested in Log Parser 2.2, free from Microsoft, is a really good tool for accessing and reporting on log files, including event logs. It can be used as a command line tool or called and used from a script (vbscript, etc.) or a programming language such as c#. You can easily construct sql-like queries... more at:
strebor,
I like the product and I have tested it getting remote Event log errors(FROM \\Fileserver\System). Works Great...
In my VBScript I have an arrComputers (array) created via a text file. How would I allow the SELECT Query in LogParser to enclude the server name in the FROM_Entity
Example: FROM \\Servername\System, but instead of manually entering in every server name it reads it from arrComputers.
If anyone knows please reply, looking at the Log Parser Forum for the answer.
Here is the VB Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\Scripts\Server.txt", ForReading)
strText = objTextFile.ReadAll
objTextFile.Close
arrComputers = Split(strText, VbCrLf)
For Each strComputer In arrComputers
Set objLogQuery = CreateObject("MSUtil.LogQuery")
Set objEVTInputFormat = CreateObject("MSUtil.LogQuery.EventLogInputFormat")
objEVTInputFormat.direction = "BW"
Set objNATOutputFormat = CreateObject("MSUtil.LogQuery.NativeOutputFormat")
objNATOutputFormat.rtp = -1
strQuery = "SELECT TimeWritten AS TIME, EventTypeName AS EVENT, EventID, TO_UPPERCASE( EXTRACT_PREFIX(Message, 4, ' ') ) AS DESCRIPTION FROM \\hpmidb1\System WHERE ( EventTypeName = 'Error event') AND TimeWritten >= SUB ( TO_LOCALTIME(SYSTEM_TIMESTAMP()), TIMESTAMP('0000-01-05', 'yyyy-MM-dd') )"
objLogQuery.ExecuteBatch strQuery, objEVTInputFormat, objNATOutputFormat
Next