AWStats是在Sourcefroge上發展很快的一個基于perl的web日志分析工具,與其他工具相比,其優勢在于
1. 界面友好,可以根據浏覽器直接調用相應的語言界面(支援中文)
2.基于perl,并且很好的解決了跨平台的問題
3. 效率比較高,對于一個日通路量百萬的網站,是可以承受的
4. 配置友善簡單
5. 可以自由擴充
頁面可以提供的資訊
1、通路量,通路次數、頁面浏覽量、點選數、資料流量等。
2、精确到每月、每日、每小時的資料。
3、通路者國家。
4、通路者IP
5、robots/spiders的統計
6、通路者持續通路時間
7、檔案類型的統計資訊
8、客戶的浏覽器資訊
實驗環境
centos-5.5
使用軟體
apache awstats-7.0.tar.gz
軟體安裝
yum install -y httpd* awstats-7.0.tar.gz
chmod +x awstats-7.0.tar.gz
tar zxvf awstats-7.0.tar.gz
mv awstats-7.0 /usr/local/awstats
cd /usr/local/awstats/tools/
perl awstats_configure.pl
---- AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).
-----> Running OS detected: Linux, BSD or Unix
-----> Check for web server install
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
>/etc/httpd/conf/httpd.conf apache 配置檔案位置
-----> Check and complete web server config file '/etc/httpd/conf/httpd.conf'
Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
Add '<Directory>' directive
AWStats directives added to Apache config file.
-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
File awstats.model.conf updated.
-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y
-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> www.test.com 做日志通路的域名
-----> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
> 預設設定
>
-----> Create config file '/etc/awstats/awstats.www.test.com.conf'
Config file /etc/awstats/awstats.www.test.com.conf created.
-----> Restart Web server with '/sbin/service httpd restart'
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.aabbcc.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...
A SIMPLE config file has been created: /etc/awstats/awstats.www.aabbcc.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.aabbcc.com' with command:
> perl awstats.pl -update -config=www.aabbcc.com
You can also read your statistics for 'www.aabbcc.com' with URL:
> http://localhost/awstats/awstats.pl?config=www.aabbcc.com
Press ENTER to finish... 到此配置完成
找到 LogFile="/var/log/httpd/mylog.log"
改為 LogFile="/etc/httpd/logs/access_log" 次為apache的日志檔案所在位置
LogType=W
LogFormat=1
找到 DirData="/var/lib/awstats"
改為 DirDataa="/usr/local/awstats/data/"
mkdir -p /usr/local/awstats/data/ 建立資料庫存放目錄
chmod -R 755 /usr/local/awstats/data/
chmod -R 755 /usr/local/awstats/wwwroot/cgi-bin/*.pl
cd /usr/local/awstats/wwwroot/cgi-bin
mkdir /var/www/html/awstats
perl awstats_buildstaticpages.pl -update -config=www.test.com -lang=cn
-dir=/var/www/html/awstats --awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl
Warning: Syntax error line 54 in file '/etc/awstats/awstats.www.test.com.conf'. Config line is ignored.
Launch update process : "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=www.test.com -update -configdir=
Build main page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=www.test.com -staticlinks -lang=cn -output
Build alldomains page: "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -config=www.test.com -staticlinks -lang=cn -output=alldomains
chmod -R 755 /var/www/html/awstats
vim /etc/crontab 編寫計劃任務
*/1 * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.test.com -update
驗證
如果出現通路保護,處理方法
1 關閉selinux,重新開機系統
2 給予适當的權限,實在不行(777),就能解決問題
本文轉自 mailfile 51CTO部落格,原文連結:http://blog.51cto.com/mailfile/1330155,如需轉載請自行聯系原作者