Neo's Blog

首頁 相本 討論 書籤

分類目錄
本站日誌 (51)
碎碎唸啦 (173)
網站架設 (84)
程式設計 (161)
軟體使用 (69)
電子商務 (126)
經營奇想 (48)
基金理財 (11)
聰明消費 (87)
電影心得 (47)
開放原碼 (16)
工作記錄 (2)
毛毛小記 (9)
就是不同 (2)




歷史資料
 




March 12, 2004
Awstats 多個 log 的顯示方法

一般大型網站的 Web Servre log 太大,通常會以 logrotate 將 log 分割成為數個檔案。

以 Apache 為例就是像:
access_log.1、access_log.2、access_log.3...以此類推

另外如果使用 Load balance ,也是會產生個 log 檔,但 awstats 預設的 LogFile 是只有一個,在多個 log file 的狀態下,變成無法更新至最新的狀態,這時就要使用 awstats 內建的工具logresolvemerge.pl 來合併 log ,其實用法也很簡單,只要更改網站的設定檔就好了,以本站為例就是編輯 /etc/awstats/awstats.neo.conf

找到 LogFile 的地方,原來預設單個 log 的設定如下:
LogFile="/var/log/httpd/access_log"

再來就是輸入您 logresolvemerge.pl 的路徑跟 log 的路徑及萬用字元即可。

logresolvemerge.pl 是放在 awstats 安裝路徑的 tools 裡面,因為我的 awstats 是裝在/usr/local/awstats 裡面,所以完整路徑就是 /usr/local/awstats/tools/logresolvemerge.pl 。

另外我是要合併 access_log.1、access_log.2、access_log.3 的 LogFile 更改範例如下:

LogFile="/usr/local/awstats/tools/logresolvemerge.pl /var/log/httpd/access_log* |"

編輯存檔後,再來執行更新記錄程式即可,如:
#/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=xxx -update

再來進去您的網址就可以看到合併後輸出的結果了,如:
http://www.yoursite.com/awstats/awstats.pl?config=xxx

 
由 Neo 發表於 March 12, 2004 03:40 PM 收進你的MyShare個人書籤  

環境是tomcat請問該將logfile指向哪裡呢
作業系統是win server 2003


艾芬 發表於 August 17, 2005 09:51 AM

已經安裝perl與awstatus了但是不曉得該如何正確設定
tomcat的版本是5.5版
站台的入逕是C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT


艾芬 發表於 August 17, 2005 09:59 AM

請neo大大幫幫幫忙^^


艾芬 發表於 August 17, 2005 10:00 AM

使用Awstats 多個 log 的顯示方法,是用來解決單一Logfile過大,

但如果要一台awstats可以分析多台網頁伺服器的流量該如何處理呢?

一台可分析多台,

除了將log拷貝到awstats之外還有別的方法嗎?


有疑問的人 發表於 December 21, 2005 06:07 PM

装了,确实很好用


mining lamp 發表於 December 18, 2006 09:59 PM

高手请帮忙解决,谢谢!
  我假如启用了两个站点,一个是a.web.com, 另一个是b.web.com,我现在想对这两个站点,我现在分析这两个日志,原来awstats.a.web.com.conf日志文件的配置信息为:
LogFile="E:\databack\site\a\Log\W3SVC287078791\ex%YY-0%MM-0%DD-0.log"
现在改为:LogFile="E:/databack/site/a/cgi-bin/logresolvemerge.pl E:/databack/site/a/Log/W3SVC287078791/ex%YY-0%MM-0%DD-0.log E:/databack/site/b/Log/W3SVC1857510694/ex%YY-0%MM-0%DD-0.log |"
其它的配置参数修改没问题,因为针对"awstats.a.web.com.conf"更新时没问题,可以升级.但是改成上面那样就不能升级了, E:\databack\site\a\cgi-bin>perl awstats.pl -config=a.web.com -lang=cn

就出现以下错误提示:
Update for config "./awstats.a.web.com.conf"
With data in log file "E:/databack/site/a/cgi-bin/logresolvemerge.pl E:/dat
aback/site/a/Log/W3SVC287078791/ex070423.log E:/databack/site/b/Log/W3S
VC1857510694/ex070423.log |"...
Phase 1 : First bypass old records, searching new record...
Direct access to last remembered record has fallen on another record.
So searching new records from beginning of log file...
AWStats did not find any valid log lines that match your LogFormat parameter, in
the 50th first non commented lines read of your log.
Your log file E:/databack/site/a/cgi-bin/logresolvemerge.pl E:/databack/sit
e/a/Log/W3SVC287078791/ex070423.log E:/databack/site/b/Log/W3SVC1857510
694/ex070423.log | must have a bad format or LogFormat parameter setup does not
match this format.
Your AWStats LogFormat parameter is:
2
This means each line in your web server log file need to have "MSIE Extended W3C
log format" like this:
date time c-ip c-username cs-method cs-uri-sterm sc-status sc-bytes cs-version c
s(User-Agent) cs(Referer)
And this is an example of records AWStats found in your log file (the record num
ber 50 in your log):
2007-04-22 16:00:02 GET /images/hotflash_top_right.gif - 124.114.179.106 HTTP/1.
1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1) http://b.web.com/C
ategory.aspx?CategoryID=19 200 1459
Setup ('./awstats.a.web.com.conf' file, web server or permissions) may be w
rong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

请高手帮忙指教,我是在IIS,windows 2003环境下的配置


justin 發表於 April 23, 2007 10:44 AM

不好意思,冒昧打擾,想請問一下:
若IIS Logfile沒有產生IIS Log file(或遺失),則logresolvemerge.pl 的執行會發生錯誤,是否有在合併時忽略不存在logfile的參數可以設定??
(還是您有其他的好方法可以分享??)

謝謝!!


Jimmy 發表於 July 13, 2007 01:39 PM

找不到目錄的,或無法運作的,這邊有解答。

http://fvue.nl/wiki/AWStats:_bad_interpreter:_No_such_file_or_directory

順便參觀
土木人
http://bbs.civilgroup.org/


civilgroup 發表於 November 16, 2007 09:07 PM
發表迴響  
(*星號開頭為必填欄位)











(請輸入您看到的數字,看不到請按右鍵->顯示圖片)


記住我的資訊?







Copyright 2005 Neo's Blog All rights reserved.