Centos下使用AWStats分析Nginx和Apache日志

AWStats简介:

Awstats是一个免费非常简洁而且强大有个性的统计工具。它可以统计您站点的如下信息:文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

一:访问量,访问次数,页面浏览量,点击数,数据流量等文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

二:精确到每月、每日、每小时的数据文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

三:访问者国家文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

四:访问者IP文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

五:Robots/Spiders的统计文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

六:纺客持续时间文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

七:对不同Files type 的统计信息文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

八:Pages-URL的统计文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

九:访客操作系统浏览器等信息文章源自堕落的鱼-https://www.duoluodeyu.com/855.html

十:其它信息(搜索关键字等等)

下面我们来在CentOS配置AWStats来分析Nginx和Apache日志。

AWStats安装:

  cd /tmp

wget http://prdownloads.sourceforge.net/awstats/awstats-7.0.tar.gz

tar xzf awstats-7.0.tar.gz

mv awstats-7.0 /usr/local/awstats

cd /usr/local/awstats/tools

mkdir /etc/awstats /var/lib/awstats

AWStats配置:

执行awstats_configure.pl脚本进行配置。

perl 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.duoluodeyu.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):

> 回车

接着需要编辑配置文件awstats.www.duoluodeyu.com。

vi /etc/awstats/awstats.www.duoluodeyu.com.conf

只需要定义日志的路径,如:

LogFile="/home/centos/log/access.log"

复制css和icon目录到网站根目录。

cp -R /usr/local/awstats/wwwroot/css /home/www/default

cp -R /usr/local/awstats/wwwroot/icon /home/www/default

手动执行命令更新日志统计数据库及生成静态文件到目录/home/www/default/awstats:

/usr/local/awstats/tools/awstats_buildstaticpages.pl -config=www.duoluodeyu.com  -update -lang=cn -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl  -dir=/home/www/default/awstats

之后你就可以使用http://ip或域名/awstats/awstats.www.duoluodeyu.com.html访问日志统计页面。

添加脚本awstats_buildstaticpages.pl到cron定时生成日志统计页面。

crontab -e

58 23 * * * /usr/local/awstats/tools/awstats_buildstaticpages.pl  -config=www.duoluodeyu.com -update -lang=cn  -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl  -dir=/home/www/default/awstats

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 :定义输出静态页面的目录。

 

 最后更新:2015-7-1
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证