Chinaunix首页 | 论坛 | 博客
  • 博客访问: 625330
  • 博文数量: 110
  • 博客积分: 3808
  • 博客等级: 中校
  • 技术积分: 1930
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-15 14:32
个人简介

声的伟大!

文章分类

全部博文(110)

文章存档

2014年(1)

2013年(2)

2012年(12)

2011年(81)

2010年(14)

分类: LINUX

2011-04-22 15:06:40

Awstats是一个免费非常简洁而且强大有个性的统计工具。它可以统计您站点的如下信息:
 一:访问量,访问次数,页面浏览量,点击数,数据流量等
 二:精确到每月、每日、每小时的数据
 三:访问者国家
 四:访问者IP
 五:Robots/Spiders的统计
 六:纺客持续时间
 七:对不同Files type 的统计信息
 八:Pages-URL的统计
 九:访客操作系统浏览器等信息
 十:其它信息(搜索关键字等等)

 

1、首先下载最新版的awstats至某目录中,而后进行安装配置的准备工作:

 

# mkdir /var/lib/awstats

# tar zxvf awstats-6.95.tar.gz

# mv awstats-6.95  /usr/local/awstats

 

2、配置awstats

 

# cd /usr/local/awstats

# mkdir -m 755 data

# perl tools/awstats_configure.pl

 

----- AWStats awstats_configure 1.0 (build 1.8) (c) Laurent Destailleur -----

This tool will help you to configure AWStats to analyze statistics for

one web server. You can try to use it to let it do all that is possible

in AWStats setup, however following the step by step manual setup

documentation (docs/index.html) is often a better idea. Above all if:

- You are not an administrator user,

- You want to analyze downloaded log files without web server,

- You want to analyze mail or ftp log files instead of web log files,

- You need to analyze load balanced servers log files,

- You want to 'understand' all possible ways to use AWStats...

Read the AWStats documentation (docs/index.html).

-----> Running OS detected: Linux, BSD or Unix

-----> Check for web server install

Enter full config file path of your Web server.

Example: /etc/httpd/httpd.conf

Example: /usr/local/apache2/conf/httpd.conf

Example: c:\Program files\apache group\apache\conf\httpd.conf

Config file path ('none' to skip web server setup):

> /etc/httpd/conf/httpd.conf      ---------此处需要给出httpd的主配置文件的位置以使得awstats可以添加新的配置项。如果此前已经做过此配置,则使用"none"略过此步。

 

Your web server config file(s) could not be found.

You will need to setup your web server manually to declare AWStats

script as a CGI, if you want to build reports dynamically.

See AWStats setup documentation (file docs/index.html)

-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'

  File awstats.model.conf updated.

-----> 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        ----------这里用来指定是否需要为某站点创建统计日志的配置文件,如果需要,则指定"y"

 

-----> Define config file name to create

What is the name of your web site or profile analysis ?

Example: 

Example: demo

Your web site, virtual server or profile name:

>          ---------这里接上一步,说明需要为哪个站点创建统计日志所需的配置文件,此名字仅作为标识站点的名称使用,因此可以使用您方便区别和记忆的名字。

 

-----> 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):

>         -------这里指定上述配置文件的存放目录,默认为/etc/awstats,通常默认即可。

 

-----> Create config file '/etc/awstats/awstats.'

 Config file /etc/awstats/awstats. created.

 

-----> Add update process inside a scheduler

Sorry, configure.pl does not support automatic add to cron yet.

You can do it manually by adding the following command to your cron:

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

Or if you have several config files and prefer having only one command:

/usr/local/awstats/tools/awstats_updateall.pl now

Press ENTER to continue...            --------“回车”继续

 

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

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

You can then manually update your statistics for '' with command:

> perl awstats.pl -update -config=

You can also build static report pages for '' with command:

> perl awstats.pl -output=pagetype -config=

Press ENTER to finish...       --------“回车”继续,并结束配置过程

 

3、调整前面为某站点创建的统计日志所需的配置文件中指定的、某站点实际使用的日志文件的路径

# vim /etc/awstats/awstats.

找到如下行:

LogFile="/var/log/httpd/mylog.log"

把后的日志文件的路径修改为您此站点实际日志文件的路径即可,如您的日志文件路径为“/var/log/httpd/access_log”,需要将上述行修改为如下行:

LogFile="/var/log/httpd/access_log"

#此处为LogFile="/var/log/httpd/eboy.access"(我的配置)

 

4、手动更新网站的统计数据,以上面的为例

# cd /usr/local/awstats/wwwroot/cgi-bin/

赋予执行权限

# perl awstats.pl -update -config=

 

现在就可以在浏览器地址栏输入类似如下地址查看日志了:

 

# http:///awstats/awstats.pl?config=

此处为

 

注: 如果需要将某统计信息生成为静态的html页面,使用以下命令即可实现:

perl awstats.pl -output=pagetype -config= > awstats..html

 

5、可以将以上命令放到crontab中执行,并根据需要指定更新的频率和时间:

33 6 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config= >/dev/null 2>&1

 

如图所示:

如下

 

阅读(3155) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~