使用awstats分析iis站点的日志
环境:win7 + iis7 + perl(ActivePerl-5.20.1.2000) + awstats 7.3
一、找到iis日志所在目录


建议全部都打勾

二、安装perl
AWStats是perl语言书写的程序,所以必选先安装ActivePerl程序。
1、下载http://www.activestate.com/activeperl/downloads

2、安装

记住perl的安装路径,后面会用到



三、配置awstats
1、下载awstats
http://sourceforge.net/projects/awstats/,最新版为7.3
2、解压到文件夹
3、配置iis站点
站点配置到wwwroot文件夹

Iis站点 >> 功能视图 >> 处理程序映射,添加对pl文件后缀名的解析

在弹出的对话框,点击否

Internet信息服务(IIS)管理器 >> 点击左侧的计算机名 >> ISAPI 和 CGI限制 >> 设置允许

1、配置
找到wwwroot/cgi-bin/awstats.model.conf,把model改为需要统计站点的host,比如www.mysite.com,即awstats.www.mysite.com.conf,主要说明配置如下:
LogFile:日志文件的位置(ex%YY-24%MM-24%DD-24 为过去24小时格式)
LogFile="C:/WINDOWS/system32/LogFiles/W3SVC1/ex%YY-24%MM-24%DD-24.log"
LogType:日志类型(W-web log; M-mail log; F-ftp log)
LogType=W
LogFormat:日志格式(1-Apache or Lotus Notes日志格式; 2-IIS日志格式)
LogFormat="date time cs-method cs-uri-stem cs-username c-ip cs-version cs(User-Agent) cs(Referer) sc-status sc-bytes"
*注意:IIS6.0 不能用LogFormat=2的格式,具体设置参看上一行的例子
SiteDomain:统计站点(必须设置)
SiteDomain="www.mySite.com"
DefaultFile:网站的默认页面
DefaultFile="index.html"
Logo="corplogo.jpg"
LogoLink="http://www.mySite.com"
*logo必须是在icon/other目录下
StyleSheet:样式表所在位置
StyleSheet="/css/awstats_default.css"
HTMLHeadSection="<center><h1>这个是网页头</h1></center>"
HTMLEndSection="<center><h1>这个是网页尾</h1></center>"
*可以书写html代码
Include:包含另外一个conf文件
Include "awstats.public.conf"
说明:先继承另外一个conf文件的设置(比如一个公共的设置),该文件的设置覆盖所继承的文件的设置。主要方便多个站点的统计。在公共设置中设置好统计的选项,其他的配置文件只需要修改日志位置(LogFile)、统计站点的名称(SiteDomain)就可以了。
参考“http://blog.chinaunix.net/uid-15811445-id-150005.html”
2、使用命令行开始统计
> cd D:/awstats-7.3/wwwroot/cgi-bin/
> awstats.pl -config=awstats.www.mysite.com.conf -update

3、测试效果 localhost:port/cgi-bin/awstats.pl?config=www.mysite.com

4、批量分析历史文件
制作pl1文件
Function Awstats
{
param ($Dir = $(Read-host "请输入iis日志文件所在目录")),
($Website = $(Read-Host "站点名(配置名)"))
$TargetFolder = $Dir
if (Test-Path $TargetFolder)
{
Write-host "DIREKTORIJ JE :" $TargetFolder -foregroundcolor "Red"
$Files = get-childitem $Dir\*.* -include *.log
$List = $Files | where {$_.extension -eq ".log"}
#write-host $List
foreach ($File in $Files)
{
write-host "Updating statistics" -foregroundcolor "Red";&'C:\perl\bin\perl.exe' awstats.pl config=$Website logfile=$File}
}
}
Awstats
完成后,把pl文件存放到awstat\wwwroot\cgi-bin目录下,记得在powershell中运行 >> .pl

问题1:
awstats-6.5/wwwroot/cgi-bin/awstats.pl -update -config=ipcn.org
Update for config "/etc/awstats/awstats.ipcn.org.conf"
With data in log file "/opt/squid/logs/access.log.20060507.ip2"...
Phase 1 : First bypass old records, searching new record...
Direct access to last remembered record has fallen on another record.
So searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 92378
Found 92378 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.
始终跳过,在官网查找了知道,在命令后加入“-showdropped -showcorrupted”,看到

我设置的网站域名和实际统计站点的域名不一样,我勒个去,所以这里强烈建议大家配置站点名和配置文件名使用实际域名。
官网解释:
Dropped records are records discarded because they were not "user HTTP requests" or were requests matching AWStats filters (See the SkipHosts, SkipUserAgents, SkipFiles, OnlyHosts, OnlyUserAgents and OnlyFiles parameters). If you want to see which lines were dropped, you can add the -showdropped option on the command line. Corrupted records are records that do not match the log format defined by the "LogFormat" parameter in the AWStats configuration file. All web servers will typically have a few corrupted records (<5%) even when everything works correctly. This can result for several reasons: 1) Web server internal bugs, 2) bad requests made by buggy browsers, 3) a dirty web server shutdown, such as unplugging the server... If all of your lines are corrupted and the LogFormat parameter in AWStats configuration file is correct, then there may be a setup problem with your web server log format. Don't forget that your LogFormat parameter in the AWStats configuration file MUST match the log file format you analyze. If you want to see which lines are corrupted, you can add the -showcorrupted option on the command line. Old records are simply records that were already processed by a previous update session. Although it is not necessary to purge your log file after each update process, it is highly recommended that you do so as often as possible. New records are records in your log file that were successfully used to build/update the statistics database. Note: A log analysis process might be slow (one second for each 4500 lines of your logfile with an Athlon 1Ghz, plus DNS resolution time for each different IP address in your logfile if DNSLookup is set to 1 and not already done in your log file). See the Benchmarks page for more detailed information.
http://awstats.sourceforge.net/docs/awstats_setup.html
问题2:Flush history file on disk (unique url reach flush limit of 5000)
awstats.pl文件将每隔发现5千个新链接改为5万个;
> $LIMITFLUSH=5000; # Nb of records in data arrays after how we need to flush data on disk
附1:http://www.internetofficer.com/awstats/log-format/
使用awstats分析iis站点的日志的更多相关文章
- 在CentOS 6上使用 AWStats 分析 httpd 和 Tomcat 日志
准备工作: Awstats 是由perl语言编写的,所以要首先准备好awstats的运行环境.# yum install –y perl* Apache 一.首先,要安装apache服务器,并且启 ...
- 使用 awstats 分析 Nginx 的访问日志(IBM)
前言 在我的上一篇文章<使用 Nginx 提升网站访问速度>中介绍了 Nginx 这个 HTTP 服务器以及如何通过它来加速网站的访问速度.在实际的网站运营中,我们经常需要了解到网站的访问 ...
- Awstats分析Nginx日志
1.nginx日志格式设定 log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$ ...
- windows下安装awstats来分析apache的访问日志
一.啰嗦两句 之前在Windows下用Apache时,也曾经配置过Awstats,然后换了工作,改用Linux+nginx,渐渐把Apache忘记了.又换了工作,又得用Apache,这回版本更新到2. ...
- 使用awstats分析nginx日志
1.awstats介绍 本文主要是记录centos6.5下安装配置awstats,并统计nginx访问日志 1.1 awstats介绍 awstats是一款日志统计工具,它使用Perl语言编写,可统计 ...
- 烂泥:利用awstats分析nginx日志
本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb 昨天把nginx的日志进行了切割,关于如何切割nginx日志,可以查看<烂泥:切割 ...
- 网站运维工具使用iis日志分析工具分析iis日志(iis日志的配置)
我们只能通过各种系统日志来分析网站的运行状况,对于部署在IIS上的网站来说,IIS日志提供了最有价值的信息,我们可以通过它来分析网站的响应情况,来判断网站是否有性能问题,或者存在哪些需要改进的地方 对 ...
- Log Parser Studio 分析 IIS 日志
Log Parser Studio 分析 IIS 日志 来源 https://www.cnblogs.com/lonelyxmas/p/8671336.html 软件下载地址: Log Parser ...
- IIS Web服务器日志、日志服务器分析
IIS Web服务器日志.日志服务器分析 EventLog Analyzer是一款全面的工具,用于审计.管理和跟踪您的Microsoft Internet Information Services(I ...
随机推荐
- 安卓Design包之CoordinatorLayout配合AppBarLayout,ToolBar,TabLaout的使用
转载: CoordinatorLayout配合AppBarLayout,Toolbar和TabLayout的使用 控件的简单介绍: AppBarLayout:它是继承LinerLayout实现的一个V ...
- Oracle数据库作业-6 查询成绩比该课程平均成绩低的同学的成绩表
33. 查询成绩比该课程平均成绩低的同学的成绩表. select * from score a where a.degree between 0 and( select avg(degree) fro ...
- Unity之定时调用
1.Invoke(string methodName,float time) 在一定时间调用methodName函数 using UnityEngine; using System.Collectio ...
- SharePoint - 添加图片到Survey的某一问题之上
Survey是SharePoint常用功能之一,而曾经被用户多次问到的问题是能否在Survey的某一问题上添加图片,经过查看,SharePoint Survey不提供此方法,只得谷歌之,得一比较懒但又 ...
- DevExpress使用之ChartControl控件绘制图表(多坐标折线图、柱状图、饼状图)
最近因为公司项目需要用到WinForm的DecExpress控件,在这里把一些使用方法总结一下. DevExpress中有一个专门用来绘制图表的插件ChartControl,可以绘制折线图.饼状图.柱 ...
- 支持多浏览器的镜像反转css效果
今天接到一个需求,通过一张图片得到其镜像对称的图片.本来说是后台处理的,但这样除了技术上难实现之外,还带来了资源消耗的问题,相当于每张图都要存储一个副本了. 只记得以前用过css的滤镜可以实现这个,但 ...
- 写jQuery插件
如今做web开发,jquery 几乎是必不可少的,就连vs神器在2010版本开始将Jquery 及ui 内置web项目里了.至于使用jquery好处这里就不再赘述了,用过的都知道.今天我们来讨论下jq ...
- IE6中position:fixed无效问题解决
在做页面右下脚对话框时,直接使用position:fixed;大部分浏览器很容易就能做到,但是在IE6中却发现不行,原来是IE6不支持position:fixed;这个属性. 虽然用JS肯定能解决这个 ...
- IOS字体下载
结合书本与苹果官方给的例子后,总结下下载的方法. 苹果给我们提供了很多漂亮的字体,只是有些字体设备并没有内置,需要我们去下载才行. 系统提供给我们的字体名我们可以通过mac系统提供的字体册来查阅. 得 ...
- VS2013 不能打开DTCMS项目 的解决办法
<system.webServer> <validation validateIntegratedModeConfiguration="false"/> & ...