awstats 可以通過apache 部署振劳,關(guān)聯(lián)指定格式的日志文件(apache,nginx)历恐,然后通過網(wǎng)頁的形式展現(xiàn)出來专筷,便于觀察分析。
awstats的安裝
1 加壓 拷貝 創(chuàng)建需要的文件
# tar xf awstats-7.6.tar.gz ? 解壓下載到/root下的壓縮包 ? ?
# mkdir /usr/local/awstats ?
# mkdir /var/lib/awstats ?
# chmod 755 /usr/local/awstats ?
#cp -R awstats-6.5/ /usr/local/awstats ? ??
# cd /usr/local/awstats/ ? ? ?進入到解壓目錄下 ? ?
# ls ? ? ?
docs ?README.TXT ?tools ?wwwroot ? ?
# cd tools/ ? ?
# ls ? ?
# perl awstats_configure.pl ??
1 Config file path ('none' to skip web server setup):
> none ? ? ?默認填寫none就OK
2 ?Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y ? ?默認yes就OK
3 Your web site, virtual server or profile name:
> www.a10.com ? ? ? ? ? ? ? ? 上面介紹過通過www.a10.com來訪問 并進行日志分析
4 Default: /etc/awstats ? ? ? ? ? 默認的配置文件存放位置
Directory path to store config file(s) (Enter for default):
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?敲enter鍵默認即可
? ? OK 交互界面結(jié)束
2 ?配置awstats的配置文件
# cd /etc/awstats ?
# vim awstats.www.linuxidc.com.conf ? ??
? //修改一下幾項即可 其它都可以默認 ?
LogFile="/var/log/httpd/access_log"?
DirData="/var/lib/awstats"?
DirCgi="/awstats"?
DirIcons="/awstatsicons"?
//執(zhí)行下面的命令?
# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.a10.com ?
4 ?配置web的配置文件
# vim /etc/httpd/conf/httpd.conf
? //在行尾添加如下內(nèi)容
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 ?
? ? # todo Allow open access:
? ? Require all granted ?
</Directory>?
5 重啟服務
#service httpd restart?
瀏覽器中輸入http://www.a10.com/awstats/awstats.pl?config=www.a10.com 即可
看到如下圖的日志分析頁面
參考鏈接: