免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12345下一页
最近访问板块 发新帖
查看: 23580 | 回复: 43
打印 上一主题 下一主题

[Web] 日志分析软件awstats的安装使用简易指南 [复制链接]

论坛徽章:
1
处女座
日期:2013-08-19 15:17:06
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-11-04 16:23 |只看该作者 |倒序浏览
日志分析软件awstats的安装使用简易指南

1. 下载地址

   http://sourceforge.net/projects/awstats/
   
   http://voxel.dl.sourceforge.net/ ... ts-6.4-1.noarch.rpm
2. 安装   
   2.1 rpm安装

[root@web tools]# rpm -ivh awstats-6.4-1.noarch.rpm
Preparing...                ########################################### [100%]
   1:awstats                ########################################### [100%]

----- AWStats 6.4 - Laurent Destailleur -----
AWStats files have been installed in /usr/local/awstats

If first install, follow instructions in documentation
(/usr/local/awstats/docs/index.html) to setup AWStats in 3 steps:
Step 1 : Install and Setup with awstats_configure.pl (or manually)
Step 2 : Build/Update Statistics with awstats.pl
Step 3 : Read Statistics
   
   2.2 tar包安装
   
       直接解压就行了,因为awstats是由perl编写的。其实都一样。
      
3. 运行配置脚本生成awstats的配置文件
   cd /usr/local/awstats/tools
   perl awstats_configure.pl
   配置脚本询问域名等问题,假设回答的域名为www.abcd.com
   3.1 生成的配置文件会放在/etc/awstats/下面
   3.2 生成的配置文件的名称为awstats.www.adcd.com.conf
   3.3 配置脚本只能修改主要的log日志为combined,如果设置了虚拟主机,需要分别修改虚拟主机中的日志配置。
       格式设置 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        自定义的日志采用什么格式 CustomLog logs/testmysite-access_log combined
        创建日志 TransferLog logs/testmysite-access_log
        
4. 编辑awstats.www.abcd.com.conf,保证awstats的正常运行

   4.1 设置web server的logfile位置
       编辑LogFile为web server的log文件位置
       LogFile=/usr/local/apache2/logs/abcd-access_log
       一定保证和httpd.conf中的log文件保证一致,httpd.conf中log名称为
       logs/abcd-access_log
   4.2 设置要分析的服务日志类型
       LogType=W  
       w表示为WEB日志
   4.3 设置日志格式
       LogFormat=1
       1表示采用NCSA apache combined/ELF/XLF log format
   4.4 设置所要分析网站域名
       SiteDomain="www.testmysite.com.cn"
       引号中一定要填上域名,或者服务器主机名
   4.5 设置awstats的数据库存放目录
       DirData="/usr/local/awstats/data"
   
5. 创建awstats初始化数据库

   perl awstats.pl -config=www.abcd.com -update
   
6. 创建awstats的初始化静态统计页面

   perl awstats.pl -config=bbs.testmysite.com.cn -output -staticlinks > awstats.bbs.html
   
7. 通过浏览器刷新统计页面

   7.1 修改awstats.www.testmysite.com.cn.conf
       AllowToUpdateStatsFromBrowser=1
   7.2 修改awstats的存放数据目录的属性为apache的运行用户可读写
       chown -R nobody /usr/local/awstats/data
   7.3 检查/usr/local/awstats/wwwroot/cgi-bin/*.pl 是否有执行权限
       chmod +x /usr/local/awstats/wwwroot/cgi-bin/*.pl   
      
       注:rpm安装包里面的*.pl都具有执行权限,tar包里面的*.pl却没有。
      

8. 设置需要认证才能访问流量统计页面

   8.1 设置用户admin有权访问该页面
       cd /usr/local/apache2/bin
       ./htpasswd  -c /usr/local/apache2/passwords admin
       按提示连续输入两次密码,这样就创建了admin用户才能访问流量统计页面。
      
   8.2 设置httpd.conf中的awstats条目增加如下内容
           AuthType Basic
           AuthName "Restricted Files"
           AuthUserFile /usr/local/apache2/passwords
           Require user admin
           
9. 两种观看日志分析方法的比较
   
   9.1 静态页面分析方法的优点
       a. 安全性高,因为分析过程可以在后台通过crontab来执行,不需要执行cgi.
       b. 统计分析页面响应速度快,因为是自动生成的静态页面,所以速度快过动态生成的页面。
       c. 对服务器的负载影响可控,自动生成的脚本执行次数一定,对服务器的负载影响也是一定的。
   9.2 动态页面分析方法的优点
       a. 实时查看,可以随时在页面动态刷新统计分析结果。
      
   9.3 上面两种方法的缺点就是他们优点的反面。
   
10. awstats在apache虚拟主机下的配置   
      
   10.1 虚拟主机有3个
        www.testmysite.com.cn
        bbs.testmysite.com.cn
        diy.testmysite.com.cn
   10.2 生成并修改对应虚拟主机的配置文件
   
        cd /etc/awstats
        cp awstats.www.testmysite.com.cn.conf awstats.bbs.testmysite.com.cn.conf
        cp awstats.www.testmysite.com.cn.conf awstats.diy.testmysite.com.cn.conf
   10.3 修改配置文件中的下列各项  
        LogFile=/usr/local/apache2/logs/bbs-accesss_log
        修改为实际的虚拟主机的log文件位置
        SiteDomain="bbs.testmysite.com.cn"
        修改为实际各虚拟主机的域名
   10.4 修改httpd.conf各虚拟主机中的配置
        <VirtualHost 202.108.59.23>
        。。。。。。
        CustomLog logs/testmysite-access_log combined
        TransferLog logs/testmysite-access_log
        。。。。。。
        </VirtualHost>
        主要是修改日志格式保证apache输出的日志格式和awstats配置文件中配置一致。
12. 观看流量统计方法

    12.1 用户名&密码
         admin/testmysiteok
    12.2 在浏览器输入
         
         查看主页流量分析
         http://www.testmysite.com.cn/aws ... w.testmysite.com.cn
         查看bbs流量分析
         http://www.testmysite.com.cn/aws ... s.testmysite.com.cn
         查看diy流量分析
         http://www.testmysite.com.cn/aws ... y.testmysite.com.cn
         
         为了便于使用可以将以上连接加入收藏夹。

论坛徽章:
0
2 [报告]
发表于 2005-11-04 18:13 |只看该作者
建议版主给此主题加精!
很难得!
支持楼主!
因为这个相信很多人也在寻找!

论坛徽章:
0
3 [报告]
发表于 2005-11-06 18:48 |只看该作者
我是 校园网
不可以访问

论坛徽章:
0
4 [报告]
发表于 2005-11-14 10:41 |只看该作者
最后生成的静态统计页面是英文的,怎么将页面变成中文的?

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
5 [报告]
发表于 2005-11-14 11:28 |只看该作者
原帖由 suran007 于 2005-11-14 10:41 发表
最后生成的静态统计页面是英文的,怎么将页面变成中文的?



配置文件里面可以设置预言的,你可以大开配置文件看看

论坛徽章:
0
6 [报告]
发表于 2005-11-14 15:53 |只看该作者
真是篇好文


这里是修改语言吗?
# Plugin: DecodeUTFKeys
# Perl modules required: Encode and URI::Escape
# Allow AWStats to show correctly (in language charset) keywords/keyphrases
# strings even if they were UTF8 coded by the referer search engine.
#
#LoadPlugin="decodeutfkeys"

该怎么设置?

[ 本帖最后由 lingy 于 2005-11-14 16:01 编辑 ]

论坛徽章:
1
处女座
日期:2013-08-19 15:17:06
7 [报告]
发表于 2005-11-15 13:24 |只看该作者
原帖由 lingy 于 2005-11-14 15:53 发表
真是篇好文


这里是修改语言吗?


# Plugin: DecodeUTFKeys
# Perl modules required: Encode and URI::Escape
# Allow AWStats to show correctly (in language charset) keywords/keyphrases
# strings  ...


  1. # Set your primary language (ISO-639-1 language codes).
  2. # Possible value:
  3. #  Albanian=al, Bosnian=ba, Bulgarian=bg, Catalan=ca,
  4. #  Chinese (Taiwan)=tw, Chinese (Simpliefied)=cn, Czech=cz, Danish=dk,
  5. #  Dutch=nl, English=en, Estonian=et, Euskara=eu, Finnish=fi,
  6. #  French=fr, Galician=gl, German=de, Greek=gr, Hebrew=he, Hungarian=hu,
  7. #  Icelandic=is, Indonesian=id, Italian=it, Japanese=jp, Korean=kr,
  8. #  Latvian=lv, Norwegian (Nynorsk)=nn, Norwegian (Bokmal)=nb, Polish=pl,
  9. #  Portuguese=pt, Portuguese (Brazilian)=br, Romanian=ro, Russian=ru,
  10. #  Serbian=sr, Slovak=sk, Slovenian=si, Spanish=es, Swedish=se, Turkish=tr,
  11. #  Ukrainian=ua, Welsh=cy.
  12. #  First available language accepted by browser=auto
  13. # Default: "auto"
  14. #
  15. Lang="auto"


  16. # Set the location of language files.
  17. # Example: "/usr/share/awstats/lang"
  18. # Default: "./lang" (means lang directory is in same location than awstats.pl)
  19. #
  20. DirLang="./lang"
复制代码

论坛徽章:
0
8 [报告]
发表于 2005-11-30 08:49 |只看该作者
为什么出现
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, XXX@163.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

论坛徽章:
1
处女座
日期:2013-08-19 15:17:06
9 [报告]
发表于 2005-11-30 12:42 |只看该作者
apache的错误日志贴出来看看。
原帖由 lingy 于 2005-11-30 08:49 发表
为什么出现
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email]XXX@163.c ...

论坛徽章:
0
10 [报告]
发表于 2005-11-30 13:20 |只看该作者
(13)Permission denied: exec of '/usr/local/awstats/wwwroot/cgi-bin/awstats.pl' failed

Premature end of script headers: awstats.pl

[ 本帖最后由 lingy 于 2005-11-30 13:21 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP