發新話題
打印

Awstats & Mail 流量分析

Awstats & Mail 流量分析

今天找了一下POSTFIX的分析軟體,發現AWSTATS可以做得到,至於分析的數據可用度多少,用了就知道。
以下分享一下我的安裝經驗

1、首先下載套件 http://awstats.sourceforge.net/ 現在最新版 6.2
安裝
複製內容到剪貼板
代碼:
#rpm -ivh awstats-6.2-1.noarch.rpm
If first install, follow instructions in documentation
(/usr/local/awstats/docs/index.html) to setup AWStats in 3 steps:
Step 1 : Install and Setup with awstats_configure.pl (or manually)
Step 2 : Build/Update Statistics with awstats.pl
Step 3 : Read Statistics
安裝完成,再來設定參數檔

#cd /usr/local/awstats/tools
#perl awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 1.3) (c) Laurent Destailleur ----------以下省略
>/etc/httpd/conf/httpd.conf (這裡請輸入你的APACHE的設定檔位置)

-----> Need to create a new config file ?
>Y(是否見裡設定檔名稱,這裡選YES)
>postfix (輸入你的設定檔名稱,請自行定義)

-----> Define config file path
>/etc/awstats (設定檔要放置的地方,請自行定義,但目錄必須要存在)
再來ENTER ENTER,這裡只是說明一些資訊,如自動UPDATE....有興趣自己再看一下

2.# vi /etc/awstats/awstats.postfix.conf
更改下列選項
LogFile="perl /usr/local/awstats/tools/maillogconvert.pl standard < /var/log/maillog |"
(利用作者寫的一支perl的程式將系統MAILLOG更改為awstats看的懂的格式)
LogType=M
(log格式為mail)w為web,s為stream,f為ftp各取所需吧。本人需要maillog所以設定為M)

LogFormat=LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"

DirData="/etc/awstats/postfix"

DirCgi="/var/www/cgi-bin"

DirIcons="/awstatsicons"

存檔離開
基本上更改這些設定就可以使用,更深入的部份,自己研究一下囉
#cp -R /usr/local/awstats/wwwroot/icon /var/www/html/
把程式要顯示的ICON複製到網頁路徑
#mkdir /etc/awstats/postfix
建立DirData目錄

最後
#/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=postfix
Update for config "/etc/awstats/awstats.postfix.conf"
With data in log file "perl /usr/local/awstats/tools/maillogconvert.pl standard < /var/log/maillog |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 358876
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 358815 new qualified records.
這樣就成功了

再來連上
http://localhost/awstats/awstats.pl?config=postfix

成功,資料出現了。恭喜!有錯誤的話就看錯誤在哪裡照著檢查吧
參考文件
http://awstats.sourceforge.net/docs/index.html

TOP

發新話題