全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3875
推到 Plurk!
推到 Facebook!

好用的工具LogParser 2.2

 
timhuang
尊榮會員


發表:78
回覆:1815
積分:1608
註冊:2002-07-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-03-19 22:52:45 IP:220.132.xxx.xxx 未訂閱
LogParser 是一套用來分析 log 的工具, 除了支援 iis log 外, 還能利用很接近 sql command 的語法分析或統計 log 的資訊. 新的版本 (2.2) 支援了更多種的輸入資料, 如    IIS Log File Input Formats IISW3C,IIS,BIN,IISODBC,HTTPERR,URLSCAN Generic Text File Input Formats CSV,TSV,XML,W3C,NCSA,TEXTLINE,TEXTWORD 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,ETW,COM 輸出的格式除了一些文字型態外, 更棒的是可以配合 OWC (Office Web Component)產生相當多種型態的圖形, 也很容易使用, 參考範例如下, example: http://www.microsoft.com/technet/scriptcenter/tools/logparser/lpexamples.mspx 下載地點: http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=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;
如此一來便能將分析的結果和程式碼內容作完美的結合! 真的是一個相當好用的分析工具啊. 還有相當多的應用, 相信你會發現功能真的很強大!
系統時間:2024-05-17 17:56:10
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!