Thomas Kramer

IT-COW | MS Log Parser

MS Log Parser

By Administrator at April 11, 2010 18:00
Filed Under: Administration, Anleitungen

Der MS Log Parser ist auch ein praktisches Programm. Den gibt es kostenlos bei Microsoft zum Download. Ein Tutorial dazu ist in der c't 4/2008 zu finden.

 

Mit diesem Programm lassen sich SQL-Abfragen, wie man es von Datenbanken kennt, auf alle möglichen Datenquellen ausführen (also filtern) und das Ergebnis in dem gleichen oder einem anderen Format speichern. Dazu unterscheidet der Log Parser in Input und Output-Formate.

 

Das hier sind die Input-Formate, die das Programm kennt (aus der Hilfe-Datei):


IIS Log File Input Formats

  • IISW3C: parses IIS log files in the W3C Extended Log File Format.
  • IIS: parses IIS log files in the Microsoft IIS Log File Format.
  • BIN: parses IIS log files in the Centralized Binary Log File Format.
  • IISODBC: returns database records from the tables logged to by IIS when configured to log in the ODBC Log Format.
  • HTTPERR: parses HTTP error log files generated by Http.sys.
  • URLSCAN: parses log files generated by the URLScan IIS filter.

Generic Text File Input Formats

  • CSV: parses comma-separated values text files.
  • TSV: parses tab-separated and space-separated values text files.
  • XML: parses XML text files.
  • W3C: parses text files in the W3C Extended Log File Format.
  • NCSA: parses web server log files in the NCSA Common, Combined, and Extended Log File Formats.
  • TEXTLINE: returns lines from generic text files.
  • TEXTWORD: returns words from generic text files.

System Information Input Formats

  • EVT: returns events from the Windows Event Log and from Event Log backup files (.evt files).
  • FS: returns information on files and directories.
  • REG: returns information on registry values.
  • ADS: returns information on Active Directory objects.

Special-purpose Input Formats

  • NETMON: parses network capture files created by NetMon.
  • ETW: parses Enterprise Tracing for Windows trace log files and live sessions.
  • COM: provides an interface to Custom Input Format COM Plugins.


Und das hier die Output-Formate:


Generic Text File Output Formats

  • NAT: formats output records as readable tabulated columns.
  • CSV: formats output records as comma-separated values text.
  • TSV: formats output records as tab-separated or space-separated values text.
  • XML: formats output records as XML documents.
  • W3C: formats output records in the W3C Extended Log File Format.
  • TPL: formats output records following user-defined templates.
  • IIS: formats output records in the Microsoft IIS Log File Format.

Special-purpose Output Formats

  • SQL: uploads output records to a table in a SQL database.
  • SYSLOG: sends output records to a Syslog server.
  • DATAGRID: displays output records in a graphical user interface.
  • CHART: creates image files containing charts.

 

Als Beispiel hier eine Abfrage von mir, die die Warnungen aus den Windows-Logs herausfiltert (also nur die Fehler anzeigt), und das kumuliert für das Anwendungs-, das System- und HomeServer-Log:

 

LogParser -i:EVT -o:CSV "Select EventLog, ComputerName, EventId, EventTypeName, TimeGenerated, SourceName, Message INTO C:\temp\Server_Errors.csv FROM \\Server\SYSTEM, \\Server\APPLICATION, \\Server\HOMESERVER where EventTypeName='Error event' order by TimeGenerated desc" -headers:ON -oDQuotes:ON

 

Wie man aus dem Befehl sieht geht das im Prinzip auch remote von einem anderen Rechner aus, jedoch ist keine Authentifizierung vorgesehen, es gibt keine Parameter um Benutzer und Passwort zu übergeben (beim Lesen aus dem Event Log nicht, beim Schreiben in eine Datenbank schon). An die Windows-Logs kommt man nur mit Administrator-Rechten, also geht dieser Befehl remote nicht. Aber für den Fall benutzt man ja sowieso eher Monitoring-Software wie NAGIOS. Dazu fällt mir ein, ich habe NAGIOS immer noch nicht zum Laufen bekommen bei mir, das stürzt hier immer mit einem SIGSEGV-Fehler ab...

 

MS Log Parser kann man auch als Konverter benutzen, also XML in CSV-Dateien wandeln und ähnliches... oder Einträge aus dem Event Log in eine Datenbank schreiben... oder die Größe von Benutzerprofilen von der Festplatte auszulesen.

 

Pingbacks and trackbacks (1)+

Kommentar schreiben




  Country flag
biuquote
  • Kommentar
  • Live Vorschau
Loading


Tag-Wolke

Monats-Liste