Welcome to WebmasterWorld Guest from 18.208.159.25

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Has anyone used the Log Parser 2.0 Tool from Microsoft?

     
3:31 pm on Mar 6, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 6, 2003
posts:7
votes: 0


Here is the link. [microsoft.com ]

How in the world do you use it?

I want to do a simple query of the log file in VB.

Thanks

3:48 pm on Mar 6, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 25, 2002
posts:872
votes: 0


Normally speaking you'd include the appropriate reference via the "project" menu and then explore the interface it provides you...

I will admit I had trouble spotting it at first so I browsed to the directory and selected the "LogParser.dll" (essentially force registration & select) - at which point the "MS Utility Type Library - Log Parser" entry was highlighted for me.

From here the object browser seems to suggest that MSUtil is the root object with the logical start point being the LogQueryClass with its Execute method.

Don't take this the wrong way but if you couldn't get this far I think interacting with an interface which includes minimal documentation isn't for you.

If you still want to try I recommend reading page 40 onwards of the manual that gets installed (LogParser.doc) as this relates to the interface, although as expected this describes it in a style suitable for C rather than VB.

- Tony

4:00 pm on Mar 6, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 6, 2003
posts:7
votes: 0


Thank you and I did get it referenced correctly. I am just not clear on how to point to a log file of my choice?

Thanks for any help you can offer

4:18 pm on Mar 6, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 25, 2002
posts:872
votes: 0


To quote the manual;

ILogRecordset Execute( BSTR szQuery [, InputSource] )

This method executes the specified SQL-type query. If InputSource is not specified, the LogQuery object tries to determine what InputSource to use based on the FROM statement. The method returns a LogRecordset object.

So essentially as I thought earlier you want to use the MSUtil.LogQueryClass and give it your query plus an optional input source - in return it gives you an recordset containing the results. Which is nice.

(note that the inputsource appears to be one of the inputtype objects)

A combination of the object browser, reading the manual and trial+error should see you through...

- Tony

4:32 pm on Mar 6, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 6, 2003
posts:7
votes: 0


that is what I have. Can I specify an absolute path to the logfile?
4:39 pm on Mar 6, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 25, 2002
posts:872
votes: 0


If you read the manual it explains what you can and cannot use as a path based on the input type you are using...

- Tony

4:46 pm on Mar 6, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 6, 2003
posts:7
votes: 0


ok thanks I guess I am just dead headed
4:48 pm on Mar 6, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 6, 2003
posts:7
votes: 0


This is basic but it works.


Private Sub Command1_Click()
Dim objParser As MSUtil.LogQueryClass
Set objParser = New MSUtil.LogQueryClass
Dim rs As MSUtil.ILogRecordset
Dim sql As String

sql = _
"SELECT " & _
"* " & _
"FROM C:\LogPArseTest\ex0302.log "

Set rs = objParser.Execute(sql)

Dim logrecord As MSUtil.ILogRecord

Do Until rs.atEnd
Set logrecord = rs.getRecord
Debug.Print logrecord.getValue(2)
rs.moveNext
Loop

End Sub
7:13 pm on Mar 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 13, 2002
posts:2175
votes: 0


browsed to the directory and selected the "LogParser.dll" (essentially force registration & select)

THANK YOU! - no more DOS....

J4U - With app in same folder, this works :
sql = "SELECT * FROM " & App.Path & "/ex030307.log"

7:17 pm on Mar 7, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 6, 2003
posts:7
votes: 0


cool huh?