Awstats是一个免费非常简洁而且强大有个性的统计工具。它可以统计您站点的如下信息:
一:访问量,访问次数,页面浏览量,点击数,数据流量等
二:精确到每月、每日、每小时的数据
三:访问者国家
四:访问者IP
五:Robots/Spiders的统计
六:纺客持续时间
七:对不同Files type 的统计信息
八:Pages-URL的统计
九:访客操作系统浏览器等信息
十:其它信息(搜索关键字等等)
下面我们来在CentOS配置AWStats来分析Nginx和Apache日志。
执行awstats_configure.pl脚本进行配置。
配置过程如下:
Config file path (‘none’ to skip web server setup):
none
—–> 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.centos.bz
—–> 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):
> 回车
接着需要编辑配置文件awstats.www.centos.bz.conf。
只需要定义日志的路径,如:
复制css和icon目录到网站根目录。
手动执行命令更新日志统计数据库及生成静态文件到目录/home/www/default/awstats:
之后你就可以使用http://ip或域名/awstats/awstats.www.centos.bz.html访问日志统计页面。
添加脚本awstats_buildstaticpages.pl到cron定时生成日志统计页面。
awstats_buildstaticpages.pl脚本使用说明:
语法:awstats_buildstaticpages.pl (awstats_options) [awstatsbuildstaticpages_options]
awstats_options可选参数为:
-config=configvalue:定义配置文件,如www.centos.bz,就会搜索/etc/awstats/awstats.www.centos.bz.conf文件。
-update :该选项定义生成静态页面之前先更新数据库。
-lang :统计页面的语言,如-lang=cn,语言为中文。
awstatsbuildstaticpages_options可选参数为:
-awstatsprog=pathtoawstatspl :定义awstats.pl路径。
-dir :定义输出静态页面的目录。
参考:http://awstats.sourceforge.net/docs/awstats_setup.html