最新消息:

使用awstats完成门户社区流量统计分析

技术 admin 2818浏览 0评论

    Web站点中主要有三类数据:内容数据、结构数据、使用数据。同时Web Mining也分成三类:Web Content Mining、Web Structure Mining、Web Usage Mining。

    Web Content Mining和Web Structure Mining的对象都是网络上的原始数据。

    Web Usage Mining面对的是用户和网络交互过程中抽取出来的二手数据,这些数据主要是用户在访问Web时在Web日志(logs)里留下的信息,以及其它一些交互信息,包括:访问日期、时间、用户IP地址、服务器IP地址、方法、所请求URL资源、服务器响应状态、用户代理、发送字节等。Web Usage Mining就是对Server Logs、Error Logs、Cookie Logs等日志信息,以及用户的注册数据、社区发帖数据、点击行为数据、消费数据等进行挖掘,以发现有用信息。

    可以说对门户社区的访问流量进行统计分析是进行社区运营的重要手段,可以根据用户行为分析结果及时调整网站结构,提高用户体验。

    对用户行为分析最为准确的还是诸如协同过滤这样的技术,但由于涉及统计分析等复杂算法,后期再逐步引进,目前先针对访问日志进行统计分析。

    对Web日志的分析采用awstats来完成,下面简单说明一下awstats的安装使用。

1、 系统环境:

OS:Red Hat Enterprise Linux Server release 5

Apache:httpd-2.2.3-6.el5

Perl:perl-5.8.8-10

2、 关闭selinux

vi /etc/selinux/config

SELINUX=disabled

将SELINUX=enforcing修改为disabled,重启服务器

如果不想重启服务器,执行如下命令,但是只在当次启动有效:

selinuxenabled 0

查看目前selinux的状态: sestatus

如果要查询到更多的信息,可使用sestatus –v

查看selinux对httpd的参数值:getsebool -a | grep httpd

要设定selinux对httpd的参数值,可利用setsebool,例如:

setsebool -P httpd_disable_trans 1

3、 下载awstats

wget http://awstats.sourceforge.net/files/awstats-6.9.tar.gz

4、 安装awstats

tar zxvf awstats-6.9.tar.gz

mv awstats-6.9 /usr/local/awstats

cd /usr/local/awstats/tools

perl awstats_configure.pl

………………………省略部分内容…………………………

Do you want to continue setup from this NON standard directory [yN] ? //具体设置

输入y,如果awstats放在/usr/local/目录下,则不会显示这一步

—–> Check for web server install

………………………省略部分内容………………………….

输入/etc/httpd/conf/httpd.conf

………………………省略部分内容………………………….

—–> Need to create a new config file ?

输入y

………………………省略部分内容………………………….

—–> Define config file name to create

输入你想分析的网站域名如:localhost

………………………省略部分内容………………………….

—–> Define config file path

默认即可

………………………省略部分内容………………………….

—–> Add update process inside a scheduler

回车即可

A SIMPLE config file has been created: /etc/awstats/awstats.localhost.conf

You should have a look inside to check and change manually main parameters.

You can then manually update your statistics for ‘localhost’ with command:

> perl awstats.pl -update -config=localhost

You can also read your statistics for ‘localhost’ with URL:

> http://localhost/awstats/awstats.pl?config=localhost

Press ENTER to finish…

回车安装完毕

5、 安装来访者IP未知插件:

wget http://www.ieasy.org/download/qqhostinfo.pm

cp qqhostinfo.pm /usr/local/awstats/wwwroot/cgi-bin/plugins

wget http://www.ieasy.org/download/qqwry.pl

cp qqwry.pl /usr/local/awstats/wwwroot/cgi-bin/plugins

下载QQWry.Dat(http://update.cz88.net/soft/qqwry.rar),上传到/usr/local/awstats/wwwroot/cgi-bin/plugins下

也可以使用GeoLiteCity.dat,但GeoIP对中国城市的统计不准确,在国内还是珊蝴虫和纯真版IP数据库相对准确。

6、 配置httpd

修改/etc/httpd/conf/httpd.conf,修改内容如下:

AddHandler cgi-script cgi pl

#

# Directives to allow use of AWStats as a CGI

#

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

Order allow,deny

Allow from all

</Directory>

7、 配置awstats

mkdir -p /var/lib/awstats

chmod -R +x /var/lib/awstats

修改/etc/httpd/conf/httpd.conf

将CustomLog “logs/access_log” common修改为

CustomLog “logs/access_log” combined

LoadPlugin=”qqhostinfo”

编辑/etc/awstats/awstats.localhost.conf 修改

LogFile="/etc/httpd/logs/access_log"

perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=localhost –update

8、 重启httpd

service httpd restart

9、 访问awstats

http://192.168.1.202/awstats/awstats.pl?config=localhost

10、 参考资料

http://www.ieasy.org/reload/cat2/awstats_qqhosti.html

http://www.chedong.com/tech/awstats.html

http://www.osxcn.com/journal/awstats-plugins.html

转载请注明:出家如初,成佛有余 » 使用awstats完成门户社区流量统计分析

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址