LogRecord Object

Log Parser

LogRecord Object

The LogRecord object represents a single query output record, and it exposes methods that can be used to retrieve individual field values from the output record.
The LogRecord object is returned by the getRecord method of the LogRecordSet object.

The interface name of the .NET COM wrapper for this object is "Interop.MSUtil.ILogRecord".


Methods

getValue Returns the value of a field in the output record.
getValueEx Returns the value of a field in the output record.
isNull Returns a Boolean value indicating if an output record field is NULL.
toNativeString Returns a field or the whole output record as a string value.


Examples

JScript example:

var oLogQuery = new ActiveXObject("MSUtil.LogQuery");

// Create Input Format object
var oIISW3CInputFormat = new ActiveXObject("MSUtil.LogQuery.IISW3CInputFormat");

// Create query text
var strQuery = "SELECT c-ip FROM <1> WHERE cs-uri-stem LIKE '%hitcount.asp'";

// Execute query and receive a LogRecordSet
var oRecordSet = oLogQuery.Execute( strQuery, oIISW3CInputFormat );

// Visit all records
while( !oRecordSet.atEnd() )
{
	// Get a record
	var oRecord = oRecordSet.getRecord();

	// Get first field value
	var strClientIp = oRecord.getValue( 0 );

	// Print field value
	WScript.Echo( "Client IP Address: " + strClientIp );

	// Advance LogRecordSet to next record
	oRecordSet.moveNext();
}

// Close LogRecordSet
oRecordSet.close();

VBScript example:

Dim oLogQuery
Dim oIISW3CInputFormat
Dim strQuery
Dim oRecordSet
Dim oRecord
Dim strClientIp

Set oLogQuery = CreateObject("MSUtil.LogQuery")

' Create Input Format object
Set oIISW3CInputFormat = CreateObject("MSUtil.LogQuery.IISW3CInputFormat")

' Create query text
strQuery = "SELECT c-ip FROM <1> WHERE cs-uri-stem LIKE '%hitcount.asp'"

' Execute query and receive a LogRecordSet
Set oRecordSet = oLogQuery.Execute ( strQuery, oIISW3CInputFormat )

' Visit all records
DO WHILE NOT oRecordSet.atEnd

	' Get a record
	Set oRecord = oRecordSet.getRecord

	' Get first field value
	strClientIp = oRecord.getValue ( 0 )

	' Print field value
	WScript.Echo "Client IP Address: " & strClientIp

	' Advance LogRecordSet to next record
	oRecordSet.moveNext

LOOP

' Close RecordSet
oRecordSet.close


See also:

LogRecordSet Object
Log Parser COM API Overview
C# Example


© 2004 Microsoft Corporation. All rights reserved.