Relatively new to log parser (v 2.2). Have ASP pages running fine to query IIS web logs. Now trying to get one to report on Event logs, but can't figure out how to get around access errors. When I set the path to the actual event log file, I get:
CLogQueryClass error '80070020' [The process cannot access the file because it is being used by another process.]
The script that results in that error (vbscript in asp page):
pathVar = "c:\WINDOWS\system32\config\SysEvent.evt"
fileQry = "SELECT * FROM "&pathVar
set logQuery = server.createobject("MSUtil.LogQuery")
set EVT = Server.CreateObject("MSUtil.LogQuery.EventLogInputFormat")
set recordSet = logQuery.Execute(fileQry,EVT)
I made sure the pathVar is right and I set permissions on that folder to allow everyone full control, and it still gives the same error. So, thinking that it's a file sharing violation, I set up a script to copy that file to a new one in the same folder. Now that gives a new error:
CLogQueryClass error '800705dc' [The event log file is corrupted.]
The script that results in this new error is:
pathVar = "c:\WINDOWS\system32\config\SysEvent.evt"
dim fso
set fso = server.createobject("Scripting.FileSystemObject")
dim txtPath
txtPath = "C:\WINDOWS\system32\config\MyEvent2.evt"
fso.CopyFile pathVar,txtPath
fileQry = "SELECT * FROM '"&txtPath&"' '"
set logQuery = server.createobject("MSUtil.LogQuery")
set EVT = Server.CreateObject("MSUtil.LogQuery.EventLogInputFormat")
set recordSet = logQuery.Execute(fileQry,EVT)
I double checked and I can open that original event log in the WMI Event Viewer just fine, so the original file being copied appears to be good. The new file MyEvent2.evt is there and the same size as the original.
Both errors are the same regardless of which event log file I specify.
There is surprisingly little in the book or on the web about webifying log parser, especially in vbscript. Any ideas what I'm doing wrong? Is there a different input format I s/b using for asp?