linux安裝AWStats業務資料分析工具

來源:互聯網
上載者:User

Awstats是一個非常簡潔而且強大的統計工具。它可以統計您網站的如下資訊:
一:訪問量,訪問次數,頁面瀏覽量,點擊數,資料流量等精確到每月、每日、每小時的資料
二:訪問者國家、訪問者IP、作業系統、瀏覽器等
三:Robots/Spiders的統計
四:紡客期間
五:對不同Files type 的統計資訊
六:Pages-URL的統計
七:其它資訊(搜尋索引鍵等等) 

http://awstats.sourceforge.net/   awstats官方網站

http://www.perl.com/    perl官方網站

 

 

[root@localhost awstats]# ls

awstats-7.0.tar.gz     perl-5.16.1.tar.gz

 

 安裝perl                                                              

 

  Awstats基於Perl的WEB日誌分析工具,網上關於它的介紹還是比較多的,因為是基於perl開發的,在管在windows還是linux下都需要先安裝perl環境。所以,我們先安裝perl 。其實,還需要一個apache環境,在上一節中已經進行了安裝講解。

[root@localhost awstats]# tar xvfz perl-5.16.1.tar.gz    解壓

[root@localhost awstats]# cd perl-5.16.1    進入目錄

[root@localhost perl-5.16.1# rm -f config.sh Policy.sh

[root@localhost perl-5.16.1]# sh Configure -de

[root@localhost perl-5.16.1]#make    編譯

[root@localhost perl-5.16.1]# make test

[root@localhost perl-5.16.1]# make install    安裝

 

config.sh Policy.sh   為以前安裝時的設定檔,新安裝或升級安裝時需要將其刪除。

sh Configure -de   安裝使用預設配置,一般而言將會 ok 

make test    執行make命令, 然後make根據test目標規則, 執行規定的操作。 

安裝完成後 perl 所在目錄為 /usr/local/lib/perl5, perl 執行檔案在 /usr/local/bin 中。

 

安裝awstats                                                                          

 

解壓awstats

[root@localhost awstats]# tar xvfz awstats-6.4.tgz 

[root@localhost awstats]# mkdir /etc/awstats

[root@localhost awstats]# mkdir /var/lib/awstats

上面建立的兩個目錄都將在後面的配置中用到,一個用於存放網站日誌分析的設定檔,一個用於存放日誌資料資訊。 

 

[root@localhost awstats]# cp -R ./awstats-7.0 /usr/local/   

-R 表示複製目錄及目錄內的所有項目到/usr/local/目錄下

[root@localhost test]# mv  awstats-7.0   awstats     進行一個重新命名,便於操作而已。

 

配置awstats

 

[root@localhost tools]# pwd

/usr/local/awstats//tools

Awstats的配置有內建的組態工具awstats_configure.pl ,首先用vi開啟configure.pl檔案,看看第一行有關perl運行環境的配置是否正確。 

 

[root@localhost tools]# vi awstats_configure.pl

#!/usr/bin/perl

.............

 

[root@localhost tools]# pwd

/usr/local/awstats/tools

[root@localhost tools]# perl awstats_configure.pl  回合組態檔案

Do you want to continue setup from this NON standard directory [yN] ?  你是否安裝非標準目錄【y / n】?..............file (required if first install) [y/N] ? 檔案(如果需要先安裝)【y / n】?............ your web site ,virtual server or profile name: 你的網站伺服器名或檔案名稱>demo............ directory path to store config file(s)  (enter for default):  目錄路徑儲存設定檔(填寫預設值)> /etc/awstats...........然後,兩個斷行符號配置完成。

 

  

awstats_configure.pl工具會自動修改您的apache配置,在apache的設定檔httpd.conf檔案中自動修改下面資訊 

[root@localhost conf]# pwd

/usr/local/apache/conf

[root@localhost conf]# vi httpd.conf

awstats_configure.pl自動在httpd.conf檔案最底部添加了以下內容:

# Directives to allow use of AWStats as a CGI#Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"Alias /awstatscss "/usr/local/awstats/wwwroot/css/"Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"## This is to permit URL access to scripts/files in AWStats directory.#<Directory "/usr/local/awstats/wwwroot">    Options None    AllowOverride None    Order allow,deny    Allow from all</Directory>

 

  awstats_configure.pl還將根據安裝過程中您的回答(要分析的網站名稱)資訊,自動生產 /etc/awstats/awstats.index.conf檔案 

[root@localhost awstats]# pwd

/etc/awstats

[root@localhost awstats]# ls

awstats.index.conf

[root@localhost awstats]# vi awstats.index.conf  配置下面檔案

................LogFile="/usr/local/apache/logs/access_log"     改為apache的記錄檔 ....

 

這樣就完成了awstats的安裝與配置工作。

 

 

分析日誌

 

[root@localhost cgi-bin]# pwd

/usr/local/awstats/wwwroot/cgi-bin

[root@localhost cgi-bin]# chmod +x  awstats.pl     加可執行許可權

[root@localhost cgi-bin]# perl /awstats.pl -update -config=demo      

Create/Update database for config "/etc/awstats/awstats.index.conf" by AWStats version 7.0 (build 1.971)From data in log file "/usr/local/apache/logs/access_log"...Phase 1 : First bypass old records, searching new record...Searching new records from beginning of log file...Jumped lines in file: 0Parsed lines in file: 3 Found 0 dropped records, Found 0 comments, Found 0 blank records, Found 3 corrupted records, Found 0 old records, Found 0 new qualified records.

 

  

 

在瀏覽器裡輸入:

http://localhost/awstats/awstats.pl?config=demo

然後就可以看到產生的日誌報告了

 

有可能與到下面的錯誤提示,不管你有沒有遇到,反正我是遇到了!:

Not FoundThe requested URL /awastats/awastats.pl was not found on this server.----------------------------------------------------------------------------- Apache/2.2.3 (CentOS) Server at 192.168.0.105 Port 80

 

上面的錯誤一直沒找到原因,於是,找了另一種辦法來訪問記錄檔。

[root@localhost cgi-bin]# pwd

/usr/local/awstats/wwwroot/cgi-bin

[root@localhost cgi-bin]# perl awstats.pl -update -config=demo -output -staticlinks >/var/www/html/awastats.html

這樣我們把記錄檔儲存到apache 伺服器下面,名為awastats.html

在瀏覽器裡輸入:

http://localhost/awstats.html

一樣可以訪問記錄檔噢!

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.