一. awstats基本安裝
1.cd /usr/local/
2.wget http://jaist.dl.sourceforge.net/sourceforge/awstats/awstats-6.7.tar.gz
3.tar zxvf awstats-6.7.tar.gz
4.mv awstats-6.7 awstats
5.cd tools/ 複製代碼
1../awstats_configure.pl 按提示操作組建組態檔案存放在/etc/awstats
2.cd /usr/local/awstats/wwwroot/cgi-bin/
3.cp awstats.model.conf /etc/awstats/
4.cd /etc/awstats/
5.mv awstats.model.conf common.conf
6.
7.#vi awstats.bbs.linuxtone.org.conf
8.Include "common.conf"
9.LogFile="/data/logs/access_bbs.linuxtone.org.%YYYY-24%MM-24%DD-24"
10.LogType=W
11.SiteDomain="bbs.linuxtone.org"
12.HostAliases="www.linuxtone.org"
13.DefaultFile="index.html index.php"
14.DirData="/data/www/wwwroot/tongji/statics"
15.DirIcons="/icons"
16.AllowToUpdateStatsFromBrowser=1 複製代碼二.外掛程式安裝
http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.3.tar.gz
http://www.maxmind.com/download/geoip/api/perl/Geo-IP-1.28.tar.gz
這兩個是一組,必須先編譯安裝C的,再編譯安裝perl的
安裝GeoIP
需要
1.GeoIP C Library
2.Geo::IP Perl Module (faster, but requires C library)
3.Geo::IP:urePerl Module (slower, but does not require C library)
4.C Library和Perl Module是一組,必須先編譯安裝C的,再編譯安裝perl,或者直接裝PurePerl Module,我就是這種方式 複製代碼安裝GeoIP C Library
1.# wget http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.8.tar.gz
2.# tar zxvf GeoIP-1.3.8.tar.gz
3.# cd GeoIP-1.3.8
4.# ./configure; make; make install 複製代碼安裝 Geo::IP Perl Module
# wget http://www.maxmind.com/download/geoip/api/perl/Geo-IP-1.25.tar.gz
# tar zxvf Geo-IP-1.25.tar.gz
# cd Geo-IP-1.25
# perl Makefile.PL
# make
# make test (在AS4下通不過,放棄,改裝PurePerl Module)
# make install[/code]
以上兩步也可以這樣安裝
1.# perl -MCPAN -e shell
2.cpan> install Geo::IP 複製代碼安裝Geo::IP:urePerl Module
1.# wget http://www.maxmind.com/download/ ... urePerl-1.14.tar.gz
2.# tar zxvf Geo-IP-PurePerl-1.14.tar.gz
3.# cd Geo-IP-PurePerl-1.14
4.# perl Makefile.PL
5.# make
6.# make test
7.# make install
8.也可以這樣安裝
9.# perl -MCPAN -e shell
10.cpan> install Geo::IP:urePerl
11.修改/usr/local/etc/awstats/awstats.www.test.com.conf,取消下面這行的注釋,啟用此外掛程式
12.LoadPlugin="geoip GEOIP_STANDARD" 複製代碼更新GeoIP庫
1.# cd /usr/local/share/GeoIP/
2.# wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
3.# gunzip GeoIP.dat.gz 複製代碼定時更新GeoIP庫
0 0 * * * root /usr/local/bin/geoipupdate -v
安裝XWhois
# perl -MCPAN -e shell
cpan> install Net::XWhois
修改/usr/local/etc/awstats/awstats.bbs.linuxtone.org.conf,取消下面這行的注釋,啟用此外掛程式
LoadPlugin="hostinfo"
安裝decodeutfkeys
# perl -MCPAN -e shell
cpan> install URI::Escape
修改/usr/local/etc/awstats/awstats.bbs.linuxtone.org.conf,取消下面這行的注釋,啟用此外掛程式
LoadPlugin="decodeutfkeys"
三.Tlog
1.如果我的日誌和統計分析伺服器不在一台伺服器上?如何將日誌傳到指定的伺服器上?
1.#!/bin/sh
2.rsync -avz --progress -e "ssh -p22" www@10.0.0.1:/data/logs/`date --date "1 days ago" +*.\%Y\%m\%d` /data/logs/ 複製代碼在原伺服器上刪除前一天的日誌
50 4 * * * /bin/rm -f /data/logs/`date --date "1 days ago" +*.\%Y\%m\%d`
2.分析伺服器上分析日誌,並且靜態化處理成為html顯面顯示資料.
[root@count sbin] cd /usrl/local/sbin
[root@count sbin]# vi build.sh
1.#!/bin/sh
2.#build statics pages
3./usr/local/awstats/tools/awstats_buildstaticpages.pl -update -config=bbs.linuxtone.org -lang=cn -
4.
5.dir=/data/www/wwwroot/count/tongji/data/ -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl 複製代碼將前三天的日誌清除掉.
50 5 * * * /bin/rm -f /data/logs/`date --date "3 days ago" +*.\%Y\%m\%d`
四,其它及美化
1.用Firefox瀏覽分析結果時,字型會顯得很難看(因為Firefox和IE識別11px字型不一樣),所以用Firefox瀏覽器的情況,可以通過修改
awstats.pl輸出css的相關字型尺寸進行修改,而達到用Firefox瀏覽時也和IE一樣能夠正確顯示出適當尺寸的字型。方法就是直接編
輯"/usr/local/awstats/wwwroot/cgi-bin/awstats.pl",將檔案中所有“11px”的地方都替換為 “12px。
2.如何修改報告裡的文字,如參觀者...等等這些資訊,其實修改語言報就可以
#vi /usr/local/awstats/wwwroot/cgi-bin/lang/awstats-cn.txt 修改裡面的文字就可以.
五。效果示範