habe jetzt den wrapper aber komme nicht dahinter wie ich es verwenden kann.
ich würde den log parser in den interactive mode verwenden.
dafür habe ich in der hilfe datei folgendes gefunden:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Interactive Mode
Queries executed in interactive mode do not use output formats, but rather return their output records directly to the application.
Interactive mode is useful when we want to execute a
query and receive the output records for custom processing.
A
query is executed in interactive mode by calling the Execute method of the MSUtil.LogQuery object. This method takes two arguments:
The text of the
SQL-Like
query;
An input format object.
The Execute method returns a LogRecordSet object. The LogRecordSet object is an enumerator of LogRecord objects; it allows an application to navigate through the
query output records.
Each 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 basic steps of an application using interactive mode are:
1) Instantiate the MSUtil.LogQuery object;
2) Instantiate the input format object corresponding to the input format chosen for the
query;
3) If needed, set input format object properties to change the default behavior of the input format;
4) Call the Execute method of the MSUtil.LogQuery object, specifying the
query text and the input format object, and receiving a LogRecordSet object;
5) Enter a loop that uses the atEnd, getRecord, and moveNext methods of the LogRecordSet object to enumerate the LogRecord
query result objects;
6) For each LogRecord object,
access its field values using the getValue method of the LogRecord object, and process the field values as needed;
7) When finished, dispose of the LogRecordSet object by calling its close method.
The following examples show a simple application parsing an IIS web site's logs and printing the output records to the console output.
After instantiating the main MSUtil.LogQuery object, the application instantiates the MSUtil.IISW3CInputFormat input format object, which implements the IISW3C input format.
Then, the application calls the Execute method of the MSUtil.LogQuery object, specifying the
query and the input format object, and receiving the resulting LogRecordSet object.
The LogRecordSet object is used in a loop to enumerate the LogRecord objects implementing the
query output records; the application retrieves the first field from each LogRecord object and prints it to the console output.
Finally, the application disposes of the LogRecordSet object by calling its close method.
Delphi-Quellcode:
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
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
meine Fragen jetzt:
1) ich brauche folgende Variablen:
Delphi-Quellcode:
LogQ: ILogQuery;
//die eigentliche Query
LogInterface: IInterface;
// welches Input Format benötigt wird
LogRecSet: ILogRecordset;
// die Antwort der Query als RecordSet
LogRec: ILogRecord;
// je ein Record aus RecordSet
brauche ich noch etwas um auf die ergebnisse der
query zuzugreifen?
2) erzeuge ich die objekte richtig?
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
LogQ := Create(ILogQuery);
LogRecSet := Create(ILogRecordset);
LogRec := Create(ILogRecord);
end;
3) wie rufe ich richtig die LogQuery.Execute auf?
vor allem der 2.te parameter verstehe ich nicht ganz.
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
LogRecSet := LogQ.Execute(Memo1.Text, ???);
end;
danke!