AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

microsoft log parser und delphi

Ein Thema von r_amse_s · begonnen am 6. Jun 2009 · letzter Beitrag vom 21. Feb 2012
Antwort Antwort
r_amse_s

Registriert seit: 31. Jul 2004
107 Beiträge
 
Delphi 11 Alexandria
 
#1

microsoft log parser und delphi

  Alt 6. Jun 2009, 03:26
hi,

ich möchte den log parser (COM) in delphi verwenden.
kann mir bitte jemand folgendes erklären:
- wie lade ich eine dll?
- wie greife ich auf die funktionen der dll zu?
- was muss man noch beim arbeiten mit dlls beachten?

thx
liebe Grüße
ramsi
  Mit Zitat antworten Zitat
Benutzerbild von Aphton
Aphton

Registriert seit: 31. Mai 2009
1.198 Beiträge
 
Turbo Delphi für Win32
 
#2

Re: microsoft log parser und delphi

  Alt 6. Jun 2009, 03:56
Das meinst du wohl nicht ernst oder ?
Dir ist schon bewusst, dass es (Delphi) Tutorials (zu fast allen Themen) wie Sand am Meer gibt ?

Da ich nicht nur negativ wirken möchte, hier ein Link:

Delphi-Tutorials-->DLL-Tutorial


MfG
das Erkennen beginnt, wenn der Erkennende vom zu Erkennenden Abstand nimmt
MfG
  Mit Zitat antworten Zitat
Benutzerbild von jaenicke
jaenicke
Online

Registriert seit: 10. Jun 2003
Ort: Berlin
9.330 Beiträge
 
Delphi 11 Alexandria
 
#3

Re: microsoft log parser und delphi

  Alt 6. Jun 2009, 05:49
Du musst nicht die Funktionen einer DLL nutzen, sondern das ActiveX Control in Delphi importieren, wenn ich das richtig sehe. Die entsprechende Funktion findet sich im Menü Component bzw. Komponente, wie er dort genau heißt hängt von der Delphiversion ab.
Sebastian Jänicke
Alle eigenen Projekte sind eingestellt, ebenso meine Homepage, Downloadlinks usw. im Forum bleiben aktiv!
  Mit Zitat antworten Zitat
6. Jun 2009, 08:05
Dieses Thema wurde von "SirThornberry" von "Programmieren allgemein" nach "Sonstige Fragen zu Delphi" verschoben.
r_amse_s

Registriert seit: 31. Jul 2004
107 Beiträge
 
Delphi 11 Alexandria
 
#5

Re: microsoft log parser und delphi

  Alt 7. Jun 2009, 12:58
so wie jaenicke gemeint hat, glaube ich, dass man die ActiveX importieren muss, jedoch bekomme ich eine Fehlermeldung: "Fehler beim Zugriff auf OLE-Registrierung."
ich verwende D2007 und Vista.
habe versucht vorher mit regsvr32 LogParser.dll bringt aber auch nichts...

kann bitte jemand weiterhelfen? Danke!
liebe Grüße
ramsi
  Mit Zitat antworten Zitat
r_amse_s

Registriert seit: 31. Jul 2004
107 Beiträge
 
Delphi 11 Alexandria
 
#6

Re: microsoft log parser und delphi

  Alt 7. Jun 2009, 13:22
bin ein bißchen weitergekommen:
unter Vista sollte die dll nicht in das "Programme" Verzeichnis stehen, weil das die Fehlerquelle war.
es wurde jetzt ein wrapper unit erstellt. werde versuchen es zu verwenden.
liebe Grüße
ramsi
  Mit Zitat antworten Zitat
r_amse_s

Registriert seit: 31. Jul 2004
107 Beiträge
 
Delphi 11 Alexandria
 
#7

Re: microsoft log parser und delphi

  Alt 7. Jun 2009, 16:53
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!
Angehängte Dateien
Dateityp: chm logparser_191.chm (570,9 KB, 13x aufgerufen)
Dateityp: pas msutil_tlb_195.pas (531,7 KB, 7x aufgerufen)
liebe Grüße
ramsi
  Mit Zitat antworten Zitat
rasdark

Registriert seit: 21. Feb 2012
1 Beiträge
 
#8

AW: microsoft log parser und delphi

  Alt 21. Feb 2012, 12:11
Delphi-Quellcode:
var
    iLog : ILogQuery;
    iEventLog : ICOMEventLogInputContext;
    iRS : ILogRecordset;
    iRecord : ILogRecord;
    str : string;

procedure TForm1.Button1Click(Sender: TObject);
begin
    iLog := CoLogQueryClass.Create;
    iRS := iLog.Execute('SELECT * FROM Security', iEventLog);
    while not iRS.atEnd do
    begin
       iRecord := iRS.getRecord;
       str := iRecord.getValue('TimeGenerated');
       Memo1.Lines.Add(str);
       str := iRecord.getValue(1);
       Memo1.Lines.Add(str);
     //...
    end;
end;
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:23 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz