awstats的簡單安裝及配置

一、首先下載最新版的awstats至某目錄中,然後進行安裝配置的準備工做:
 
# mkdir /var/lib/awstats
# tar zxvf awstats-6.95.tar.gz
# mv awstats-6.95  /usr/local/awstats
 
二、配置awstats
 
# cd /usr/local/awstats
# mkdir -m 755 data
# perl tools/awstats_configure.pl
 

----- AWStats awstats_configure 1.0 (build 1.8) (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      《---------此處須要給出httpd的主配置文件的位置以使得awstats能夠添加新的配置項。若是此前已經作過此配置,則使用"none"略過此步。
Your web server config file(s) could not be found.
You will need to setup your web server manually to declare AWStats
script as a CGI, if you want to build reports dynamically.
See AWStats setup documentation (file docs/index.html)
-----> 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        《----------這裏用來指定是否須要爲某站點建立統計日誌的配置文件,若是須要,則指定"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):
>         《-------這裏指定上述配置文件的存放目錄,默認爲/etc/awstats,一般默認便可。
-----> Create config file '/etc/awstats/awstats.www.test.com.conf'
 Config file /etc/awstats/awstats.www.test.com.conf created.
-----> 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.test.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.test.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.test.com' with command:
> perl awstats.pl -update -config=www.test.com
You can also build static report pages for 'www.test.com' with command:
> perl awstats.pl -output=pagetype -config=www.test.com
Press ENTER to finish...       《--------「回車」繼續,並結束配置過程

三、調整前面爲某站點建立的統計日誌所需的配置文件中指定的、某站點實際使用的日誌文件的路徑
# vim /etc/awstats/awstats.www.test.com.conf
找到以下行:
LogFile="/var/log/httpd/mylog.log"
把後的日誌文件的路徑修改成您此站點實際日誌文件的路徑便可,如您的日誌文件路徑爲「/var/log/httpd/access_log」,須要將上述行修改成以下行:
LogFile="/var/log/httpd/access_log"

四、手動更新網站的統計數據,以上面的 www.test.com爲例
# cd /usr/local/awstats/wwwroot/cgi-bin/
# perl awstats.pl -update -config=www.test.com
如今就能夠在瀏覽器地址欄輸入相似以下地址查看日誌了:
注: 若是須要將某統計信息生成爲靜態的html頁面,使用如下命令便可實現:
perl awstats.pl -output=pagetype -config=www.test.com > awstats.www.test.com.html
五、能夠將以上命令放到crontab中執行,並根據須要指定更新的頻率和時間:
33 6 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.test.com >/dev/null 2>&1
本文章轉載於異樣足跡 http://blog.chinaunix.net/u/24866/showart_2191349.html
相關文章
相關標籤/搜索