好用的工具LogParser 2.2
發表於 : 2008年 12月 2日, 02:08
LogParser 是一套用來分析 log 的工具, 除了支援 iis log 外, 還能利用很接近 sql command 的語法分析或統計 log 的資訊. 新的版本 (2.2) 支援了更多種的輸入資料, 如
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.
輸出的格式除了一些文字型態外, 更棒的是可以配合 OWC (Office Web Component)產生相當多種型態的圖形, 也很容易使用, 參考範例如下,
example: http://www.microsoft.com/technet/script ... mples.mspx
下載地點:
http://www.microsoft.com/downloads/deta ... laylang=en
另外還有非官方網站, 有相當多的討論及使用資源:
http://www.logparser.com/
最重要的, 也十分容易和程式結合, 因為安裝完成後, 就註冊了一個 com 的元件進來, 操作起來相當方便且容易, 如在 console 下查系統事件的查詢, 統計來源名稱的個數:
LogParser "SELECT SourceName, count(*) as counts FROM system group by SourceName"
至於要產生圖檔, 就這麼下:
LogParser -chartTitle:"Sample Statistics" -ChartType:Column3d -GroupSize:800x600 "SELECT SourceName, count(*) as counts into c:my.gif FROM system group by SourceName"
圖形: 使用 delphi 的範例如下,
(放個 Memo, 並 uses Comobj)
真的是一個相當好用的分析工具啊. 還有相當多的應用, 相信你會發現功能真的很強大!
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.
輸出的格式除了一些文字型態外, 更棒的是可以配合 OWC (Office Web Component)產生相當多種型態的圖形, 也很容易使用, 參考範例如下,
example: http://www.microsoft.com/technet/script ... mples.mspx
下載地點:
http://www.microsoft.com/downloads/deta ... laylang=en
另外還有非官方網站, 有相當多的討論及使用資源:
http://www.logparser.com/
最重要的, 也十分容易和程式結合, 因為安裝完成後, 就註冊了一個 com 的元件進來, 操作起來相當方便且容易, 如在 console 下查系統事件的查詢, 統計來源名稱的個數:
LogParser "SELECT SourceName, count(*) as counts FROM system group by SourceName"
至於要產生圖檔, 就這麼下:
LogParser -chartTitle:"Sample Statistics" -ChartType:Column3d -GroupSize:800x600 "SELECT SourceName, count(*) as counts into c:my.gif FROM system group by SourceName"
圖形: 使用 delphi 的範例如下,
(放個 Memo, 並 uses Comobj)
代碼: 選擇全部
var
obj: Variant;
objInputformat: Variant;
oRecordSet, oRecord: Variant;
s, scmd: string;
begin
obj := CreateOleObject('MSUtil.LogQuery');
scmd := 'SELECT SourceName, count(*) as counts FROM system group by SourceName';
oRecordSet := obj.Execute(scmd);
while not oRecordSet.atEnd do
begin
oRecord := oRecordSet.getRecord;
// Get first field value
s := oRecord.getvalue(0);
s := s + ' ' + FloatToStr(oRecord.getvalue(1));
Memo1.Lines.Add(s);
// Advance LogRecordSet to next record
oRecordSet.moveNext;
end;
obj := null;
end;
真的是一個相當好用的分析工具啊. 還有相當多的應用, 相信你會發現功能真的很強大!