awstats安装配置

来源:互联网 发布:led屏幕软件设置 编辑:程序博客网 时间:2024/05/18 14:13

参考网址:http://docs.cslabs.clarkson.edu/wiki/Install_AWStats_on_CentOS_5

Awstats的功能及作用

Awstats是一款非常强大的日志分析统计工具,它可以统计站点下的如下信息:

一:访问量,访问次数,页面浏览量,点击数,数据流量等精确到每月、每日、每小时的数据
二:访问者国家、访问者IP、操作系统、浏览器等
三:Robots/Spiders的统计
四:访客持续时间
五:对不同Files type 的统计信息
六:Pages-URL的统计
七:其它信息(搜索关键字等等) 

awstats配置和安装

Awstats基于Perl的WEB日志分析工具,网上关于它的介绍还是比较多的,因为是基于perl开发的,在管在windows还是linux下都需要先安装perl环境。

配置perl 环境

可以根据个人情况,使用tar包安装或者是rpm安装,我们以rpm为例进行安装:

Mount /dev/cdrom /mnt

Cd /mnt/Server

Rpm -ivh perl-5.8.8-38.el5.x86_64.rpm

安装awstats

下载awstats-7.3.tar.gz 

tar xvfz awstats-6.4.tgz 

 mkdir /etc/awstats

 mkdir /var/lib/awstats

上面创建的两个目录都将在后边的配置中用到,一个用于存放站点日志分析的配置文件,一个用于存放日志的数据信息

cp -R ./awstats-7.3 /usr/local/

-R表示:复制目录及目录中的所有文件到/usr/local/目录下

配置awstat

[root@localhost ~]# cd /usr/local/awstats-7.3/tools/

[root@localhost tools]# pwd

/usr/local/awstats-7.3/tools

Awstats的配置有自带的配置工具awstats_configure.pl ,首先用vi打开configure.pl文件,看看第一行有关perl运行环境的配置是否正确。 

 

[root@localhost tools]# perl awstats_configure.pl  运行配置文件

Do you want to continue setup from this NON standard directory [yN] ?  你是否安装非标准目录【y / n】?

..............

file (required if first install) [y/N] ? 文件(如果需要先安装)【y / n】?

............ 

your web site ,virtual server or profile name: 你的网站服务器名或文件名

>demo

............ 

directory path to store config file(s)  (enter for default):  目录路径存储配置文件(填写默认值)

> /etc/awstats

...........

然后,两个回车配置完成。

awstats_configure.pl工具会自动修改您的apache配置,在apache的配置文件httpd.conf文件中自动修改下面信息 

[root@localhost conf]# pwd

/usr/local/apache/conf

[root@localhost conf]# vi httpd.conf

awstats_configure.pl自动在httpd.conf文件最底部添加了以下内容:

 

 awstats_configure.pl还将根据安装过程中您的回答(要分析的网站名称)信息,自动生产 /etc/awstats/awstats.index.conf文件 

[root@localhost awstats]# pwd

/etc/awstats

[root@localhost awstats]# ls

awstats.index.conf

[root@localhost awstats]# vi awstats.index.conf  配置下面文件

修改LogFile文件位置即可。

这样就完成了awstats的安装和配置,接下来就可以进行日志分析了。

Awstats工具的使用

使用awstats工具对流量日志进行分析,并将网页中显示的数据整理成表格。

一:下载日志文件:(如修改日期2月18号的)

wget http://storage-3.chinacache.com/ftpDown/gw/14926/201402/14926_20140218_w3c.gz

解压:

gunzip 14926_20140218_w3c.gz 

二:修改配置文件中logfile

vi /etc/awstats/awstats.mnews.gw.com.cn.conf

清空静态页面文件目录中内容:

/var/www/html

查看数据文件,十一txt结尾的文件,并将mnews文件打包后删除,把包移动到其他目录中

ll /var/lib/awstats/

三:执行命令:

/usr/share/awstats/tools/awstats_buildstaticpages.pl -config=mnews.gw.com.cn -update -lang=cn awstatsprog=/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -dir=/var/www/html/ -month=02 -year=2014

四:访问

执行命令后,查看/var/www/html中静态页面是否生成,查看/var/lib/awstats/中数据文件是否生成,如果已经生成,访问网页形式的内容

http://114.80.137.2:8089/awstats.mnews.gw.com.cn.html

查看网页内容,主要查看文件类别,并将此网页另存为web档案,单个文件*mht格式的

依次查询11号至19号的所有流量数据

注:使用时开启apache,不用时,关闭!

 

0 0
原创粉丝点击