linux安裝AWStats業務數據分析工具

Awstats是一個很是簡潔並且強大的統計工具。它能夠統計您站點的以下信息:
一:訪問量,訪問次數,頁面瀏覽量,點擊數,數據流量等精確到每個月、每日、每小時的數據
二:訪問者國家、訪問者IP、操做系統、瀏覽器等
三:Robots/Spiders的統計
四:紡客持續時間
五:對不一樣Files type 的統計信息
六:Pages-URL的統計
七:其它信息(搜索關鍵字等等) css

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

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

 

 

[root@localhost awstats]# lsweb

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

 

 安裝perl                                                              
windows

 

  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    進入目錄ide

[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: 0

Parsed 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 Found

The 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

同樣能夠訪問日誌文件噢!

相關文章
相關標籤/搜索