AWStats配置与应用详解.doc_第1页
AWStats配置与应用详解.doc_第2页
AWStats配置与应用详解.doc_第3页
AWStats配置与应用详解.doc_第4页
AWStats配置与应用详解.doc_第5页
已阅读5页,还剩19页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

【原创】【AWStats】配置 Apache/Windows IIS 的日志分析工具2009年08月20日 星期四 12:09RHEL-5.3=【简介】奇码科技的美国空间是带有详细的统计流量工具 awstats,AWStats 是一套免费基于 Perl 的网站日志分析工具。这个工具界面较为友好,执行速度快,扩展功能众多,在国外空间使用 apache 服务器的,AWStats 是当之无愧的首选。Awstats 是一个免费非常简洁而且强大有个性的统计工具。它可以统计您站点的如下信息: 访问量,访问次数,页面浏览量,点击数,数据流量等 精确到每月、每日、每小时的数据 访问者国家 访问者 IP Robots/Spiders 的统计 纺客持续时间 对不同 Files type 的统计信息 Pages-URL 的统计 访客操作系统浏览器等信息其它信息(搜索关键字等等)AWStats 是一个免费的强大而有个性的工具,带来先进的网络流量,FTP 或邮件服务器统计图。 本日志分析器作为 CGI 或从命令行在数个图形网页中显示你日志中包含的所有可能信息。 它利用一部分档案资料就能经常很快地处理大量日志档案,它能分析日志文件来自从各大服务器工具,如 Apache日志档案(NCSA combined/XLF/ELF log format or common/CLF log format), WebStar,IIS (W3C的日志格式)及许多其他网站,Proxy(代理服务器)、Wap、流量服务器、邮件服务器和一些 FTP 服务器。看一看这个比较表在最著名统计工具(AWStats, Analog, Webalizer,.)之间有何特点和不同的想法.AWStats 是一个在 GNU 通用公共许可证下发行的免费软件。你可以看看这个许可证图表而知道你可以/不可以做。由于AWStats工程来自网上信息,但也作为CGI、 它可以与允许进入Perl,CGI与日志的大型网站主办提供商一起工作。=【下载安装】打开页面: /projects/awstats/# wget /project/awstats/AWStats/6.9/awstats-6.9.tar.gz也可下载# wget /project/awstats/AWStats/6.9/awstats-6.9-1.noarch.rpm# rpm -ivh awstats-6.9-1.noarch.rpmPreparing. # 100%1:awstats # 100%- AWStats 6.9 - Laurent Destailleur -AWStats files have been installed in /usr/local/awstatsIf 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.plStep 3 : Read Statistics# whereis awstatsawstats:/usr/etc/awstats/usr/local/awstats=【配置 awstats】awstats 要求将 http.conf 中的 CustomLog /yourlogpath/yourlogfile common 改为 CustomLog /yourlogpath/yourlogfile combined ,我看了一下,我默认的就是 combined,可能现在新版本默认的都是这个吧,那就不用改了。再进入 /usr/local/awstats/tools 里,运行./awstats_configure.pl 启动安装向导,# cd /usr/local/awstats/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 forone web server. You can try to use it to let it do all that is possiblein AWStats setup, however following the step by step manual setupdocumentation (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 installEnter full config file path of your Web server.Example: /etc/httpd/httpd.confExample: /usr/local/apache2/conf/httpd.confExample: c:Program filesapache groupapacheconfhttpd.confConfig file path (none to skip web server setup): /etc/httpd/conf/httpd.conf输入你 httpd.conf 的路径。对于 httpd2 系列的一般都在/etc/httpd/conf/ 这个目录下面,这里将 awstats 的配置信息直接写入了 httpd.conf。- Check and complete web server config file /etc/httpd/conf/httpd.confAdd Alias /awstatsclasses /usr/local/awstats/wwwroot/classes/Add Alias /awstatscss /usr/local/awstats/wwwroot/css/Add Alias /awstatsicons /usr/local/awstats/wwwroot/icon/Add ScriptAlias /awstats/ /usr/local/awstats/wwwroot/cgi-bin/Add directiveAWStats directives added to Apache config file.- Need to create a new config file ?Do you want me to build a new AWStats config/profilefile (required if first install) y/N ? y- Define config file name to createWhat is the name of your web site or profile analysis ?Example: Example: demoYour web site, virtual server or profile name: 下面是要生成 conf 文件的名称了,因为 conf 文件的名称都是 awstats.yourdomainname.conf 格式的,所以这里要求你输入你要监测的域名,其实这个域名只是与其他域名相区分的,并不一定非要真实的。- Define config file pathIn which directory do you plan to store your config file(s) ?Default: /etc/awstatsDirectory path to store config file(s) (Enter for default):这里是让你输入配置文件的路径,直接回车会执行默认的,当然你也可以自己定义。- Create config file /etc/awstats/.confError: Failed to open /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf for read.那是因为该路径找不到 awstats.model.conf 文件可以修改,而该文件所在的目录是 /usr/local/www/awstats/cgi-bin,既然程序只读固定的路径,那就按照它要读取的路径进行相关设置,然后重新配置一次。# cp /usr/etc/awstats/awstats.model.conf /usr/local/awstats/wwwroot/cgi-bin/# ./awstats_configure.pl- Create config file /etc/awstats/.confConfig file /etc/awstats/.conf created.- Add update process inside a schedulerSorry, 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 nowPress ENTER to continue.A SIMPLE config file has been created: /etc/awstats/.confYou 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 read your statistics for with URL: http:/localhost/awstats/awstats.pl?config=Press ENTER to finish.-更新数据#/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=Error: AWStats database directory defined in config file by DirData parameter (/var/lib/awstats) does not exist or is not writable.Setup (/etc/awstats/.conf file, web server or permissions) may be wrong.Check config file, permissions and AWStats documentation (in docs directory).对于 /var/lib/awstats 目录没有写入权限造成的# chmod 777 /var/lib/awstatschmod: cannot access /var/lib/awstats: No such file or directory# mkdir /var/lib/awstats# chmod 777 /var/lib/awstats更新数据# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=Create/Update database for config /etc/awstats/.conf by AWStats version 6.9 (build 1.925)From data in log file /var/log/httpd/mylog.log.Error: Couldnt open server log file /var/log/httpd/mylog.log : No such file or directorySetup (/etc/awstats/.conf file, web server or permissions) may be wrong.Check config file, permissions and AWStats documentation (in docs directory).日志路径错位造成的# vi /etc/awstats/.conf将LogFile=/var/log/httpd/mylog.log改成LogFile=/var/log/httpd/access_log更新数据# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=Create/Update database for config /etc/awstats/.conf by AWStats version 6.9 (build 1.925)From data in log file /var/log/httpd/access_log.Phase 1 : First bypass old records, searching new record.Searching new records from beginning of log file.Phase 2 : Now process new records (Flush history on disk after 20000 hosts).Jumped lines in file: 0Parsed lines in file: 8Found 0 dropped records,Found 0 corrupted records,Found 0 old records,Found 8 new qualified records.# cp /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf /etc/awstats/common.conf# vi /etc/awstats/.confInclude common.conf#LogFile=/var/log/httpd/mylog.logLogFile=/var/log/httpd/access_log.%YYYY-24%MM-24%DD-24# %YYYY-24%MM-24%DD-24是指用24小时前的年月日日志文件名,如access_log.20061206# LogFile=gzip -d //data/awstats/src/%YYYY-24/%MM-24/%DD-24.log.gz |SiteDomain=HostAliases= localhostDefaultFile=index.htmlDirData=/var/lib/awstatsDirData=/home/cgi-bin/awstats/data/添加定时分析指令# crontab -e20 1 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config==【配置 apache】# vi /etc/httpd/conf/httpd.conf281 DocumentRoot /var/www/html/282 DocumentRoot /usr/local/awstats/wwwroot这里将 awstats 的配置信息直接写入了 httpd.conf*Please add the following to your apache config, and restart.# Directives to allow use of AWStats as a CGI#Alias /awstatsclasses “/usr/local/www/awstats/classes/”Alias /awstatscss “/usr/local/www/awstats/css/”Alias /awstatsicons “/usr/local/www/awstats/icons/”ScriptAlias /awstats/ “/usr/local/www/awstats/cgi-bin/”# This is to permit URL access to scripts/files in AWStats directory.#Options NoneAllowOverride NoneOrder allow,denyAllow from all*对要分析的虚拟主机,将 CustomLog logs/access_xxx_log common 中的 common 改成 combined 。从新启动apache# service httpd restart-用浏览器访问:http:/server/awstats/awstats.pl?config=mysitehttp:/218.*.*.254/awstats/awstats.pl?config=The server encountered an internal error or misconfiguration and was unable to complete your request.-当你的 web 程序出现上述错误后,很有可能是文件的权限设置的不对,linux 下文件单个文件需要设置为755,当你设置的是777就会这样!-SELinux 有提示根据 SELinux 的提示,更改配置# chcon -t httpd_sys_content_t /usr/local/awstats/wwwroot/cgi-bin/awstats.pl=用浏览器再次访问:54/awstats/awstats.pl?config==把图标等文件目录复制到 WEB 的 HTML 文件发布目录下,例如:/home/apache/htdocs/ 下发布更多的批量更新脚本等在 tools 目录下,可以一并放到 cgi-bin/awstats/ 目录下升级国内主要搜索引擎和蜘蛛定义,安装 GeoIP 的应用库:C/download/geoip/api/c/ 解包,编译安装perl -MCPAN -e install Geo:IP 或者使用纯 Perl 包 perl -MCPAN -e install Geo:IP:PurePerl下载 GeoIP/GeoIPCityLite 包:解包并部署到 awstats 目录下:# wget /download/geoip/database/GeoLiteCity.dat.gz# wget /download/geoip/database/GeoLiteCountry/GeoIP.dat.gz将缺省 awstats.model.conf 命名成 common.conf修改其中的一些配置选项:LoadPlugin=decodeutfkeysLoadPlugin=geoip GEOIP_STANDARD /home/apache//cgi-bin/awstats/GeoIP.datLoadPlugin=geoip_city_maxmind GEOIP_STANDARD /home/apache//cgi-bin/awstats/GeoLiteCity.dat创建 awstats下创建:data 目录用于统计数据输出,缺省的统计输出是按月汇总的;对于日志非常大的最好选择按天统计输出,并修改awstats.pl: 设置LIMITFLUSH加10倍;$LIMITFLUSH =50000; # Nb of records in data arrays after how we need to flush data on disk可以有效提高统计的速度(减少磁盘IO),并避免按月汇总数据导致的统计文件过大;按照一下样例设置配置文件:Include common.confLogFile=/home/apache/logs/access_log.%YYYY-24%MM-24%DD-24SiteDomain=HostAliases=DefaultFile=index.htmlDirData=/home/apache/cgi-bin/awstats/data/-内容摘要:AWStats 的使用简介和配置一些改进说明。很高兴看到在 AWStats 6.3 版本开始:中文用户基本上已经只需要将配置文件中将 LoadPlugin=decodeutfkeys 启用基本上就没有什么中文搜索引擎的统计问题了,目前增加了多个国内主要搜索引擎厂商。包含了针对国内主要搜索引擎和蜘蛛定义的补丁(解包后覆盖 lib 目录下的原程序目录即可),其中也包含了本站的样例配置文件日志统计系统在站点的用户行为分析中扮演了重要的角色,尤其是对于来自搜索引擎的关键词访问统计:是很有效的用户行为分析数据来源。随着互联网多年的发展,WEB日志统计工具已经越来越成熟,功能也越来越丰富。其中有很多是开放源代码的, AWStats 就是其中非常优秀的一款。AWStats: Advanced Web StatisticsAWStats 是在Sourceforge上发展很快的一个基于 Perl 的 WEB 日志分析工具。相对于另外一个非常优秀的开放源代码的日志分析工具Webalizer,AWStats的优势在于:1. 界面友好:可以根据浏览器直接调用相应语言界面(有简体中文版)参考输出样例:/cgi-bin/awstats/awstats.pl?config=chedong2. 基于 Perl:并且很好的解决了跨平台问题,系统本身可以运行在 GNU/Linux上或 Windows 上(安装了ActivePerl后);分析的日志直接支持Apache格式 (combined)和IIS格式(需要修改)。Webalizer虽然也有Windows 平台版,但目前已经缺乏维护;AWStats 完全可以实现用一套系统完成对自身站点不同WEB服务器:GNU/Linux/Apache和Windows/IIS服务器的统一统计。3. 效率比较高:AWStats 输出统计项目比Webalizer丰富了很多,速度仍可以达到 Webalizer 的1/3左右,对于一个日访问量百万级的站点,这个速度都是足够的;4. 配置/定制方便:系统提供了足够灵活但缺省也很合理的配置规则,需要修改的缺省配置不超过3,4项就可以开始运行,而且修改和扩展的插件还是 比较多的;5. AWStats 的设计者是面向精确的Human visits设计的,因此很多搜索引擎的机器人访问都被过滤掉了,因此有可能比其他日志统计工具统计的数字要低,来自公司内部的访问也可以通过 IP 过滤 设置过滤掉。6. 提供了很多扩展的参数统计功能:使用 ExtraXXXX 系列配置生成针对具体应用的参数分析会对产品分析非常有用。更多与其他工具:Webalizer, ana

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论