ServU日志分析工具sustat.docx

上传人:b****4 文档编号:26979208 上传时间:2023-06-24 格式:DOCX 页数:13 大小:20.31KB
下载 相关 举报
ServU日志分析工具sustat.docx_第1页
第1页 / 共13页
ServU日志分析工具sustat.docx_第2页
第2页 / 共13页
ServU日志分析工具sustat.docx_第3页
第3页 / 共13页
ServU日志分析工具sustat.docx_第4页
第4页 / 共13页
ServU日志分析工具sustat.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

ServU日志分析工具sustat.docx

《ServU日志分析工具sustat.docx》由会员分享,可在线阅读,更多相关《ServU日志分析工具sustat.docx(13页珍藏版)》请在冰豆网上搜索。

ServU日志分析工具sustat.docx

ServU日志分析工具sustat

Serv-U日志分析工具(sustat)转载

sustat是一个专门用来分析Serv-U生成的logfile的工具,其功能强大,而且效率很高,但是因为是完全基于命令行操作的,所以易用性方面不够,对于一些初级用户尤显困难。

下面我将简单介绍一下sustat的使用方法,对它的使用参数加以注释,及介绍一些效率提高方法。

示例一:

统计各个帐号的使用情况,包括登陆次数,下载上传文件数和数据量,所占百分比等等。

这个也是sustat的默认功能(不带任何参数即可)。

引用

sustatredjnuredjnu050401.log

注:

红色部分为sustat的主程序,蓝色部分为欲统计的Serv-Ulogfile,我们一般设定logfile每天自动生成,所以日志文件一般以日期命名。

此出即统计2005年4月1日的FTP信息。

下同。

得到的结果类似下面,包括总的文件下载上传次数和各个不同帐号的登陆次数,下载上传文件数和文件量。

Statsfrom01Apr05000009to01Apr05235958

Usersdownloaded1179files=146738.39MB

uploaded13files=2013.99MB

UserConxDfileDMBD%UFileUMBU%

______________________________________________________________________________

1TV_ADV64549173111.4549.82%00.000.00%

2TV41534855100.5237.55%00.000.00%

3OP_DREAMSKY9234226.602.88%10.000.00%

4MUSIC84733528.582.40%00.000.00%

5JIMEY5132956.312.01%3539.5826.79%

6TV_JNU318472757.361.88%00.000.00%

7GHOUL18142728.601.86%71357.9367.42%

8TW2172147.031.46%00.000.00%

9TV_VIP72153.660.10%00.000.00%

10Anonymous46115128.310.02%00.000.00%

11TV_LIST2800.000.00%00.000.00%

12OP_K100100.000.00%159.832.97%

13OP_EDISON300.000.00%156.642.81%

______________________________________________________________________________

示例二:

统计文件下载次数。

sustatredjnuredjnu050401.log-f10

后面的绿色字为-f数字10,这里可以设定一个数字,表示输出列表的头n名,设为0则输出全部结果。

结果类似下面所示(这里我只列出头10位的数据):

________________________________________________________________________________

Sorteddownloadedfilelistfrom01Apr05000009to01Apr05235958

________________________________________________________________________________

1118xfanonymous400g连续剧个人ftp分流+存储计划.txt

228xfftproot连续剧[2005.03.14][tvb][御用闲人][粤语][dvd-rmvb][20集]御用闲人14-tvrip-52play.rmvb

324xfftproot连续剧[2005.03.14][tvb][御用闲人][粤语][dvd-rmvb][20集]御用闲人13-tvrip-52play.rmvb

420xfftproot连续剧[2005.03.30][tvb][新同居关系][粤语][dvd-rmvb][13集]新同居关系01.rmvb

514xfanonymous暨南学生网系列ftp帐号(3月3日更新).txt

613xfftproot连续剧[2005.03.30][tvb][新同居关系][粤语][dvd-rmvb][13集]新同居关系02.rmvb

711xfanonymous如何下载ftp上的资源.htm

88xfftproot连续剧[2005.03.30][tvb][新同居关系][粤语][dvd-rmvb][13集]新同居关系03.rmvb

97xfftproot连续剧[2005.03.30][tvb][新同居关系][粤语][dvd-rmvb][13集]新同居关系04.rmvb

107xfftproot连续剧[2005.03.08][韩国][浪漫满屋][韩语中文字幕][dvd-rmvb][16集]浪漫满屋04.rmvb

示例三:

统计目录下载排行。

又细分为两种情况,一种是按照目录里面文件被下载的次数排行,另一种是按照目录里面被下载的数据量排行。

sustatredjnuredjnu050401.log-d10按文件下载次数排行。

参数小写d,同样数字10表示只列出头10名。

sustatredjnuredjnu050401.log-D10按文件下载数据量排行。

参数大些D,同样数字10表示只列出头10名。

对于像连续剧这类资源,按目录进行统计更加容易反映文件的受欢迎程度。

输出结果类似:

________________________________________________________________________________

Sorteddirlistbyfilecountfrom01Apr05000009to01Apr05235958

________________________________________________________________________________

1156filesindireftproottv2[2005.02.18][韩国][大长今][韩语中文][dvd-rmvb][54集]

2145filesindirfanonymous

398filesindirfftproot连续剧[2005.03.14][tvb][御用闲人][粤语][dvd-rmvb][20集]

491filesindirfftproot连续剧[2005.03.11][国产][铁齿铜牙纪晓岚3][国语][vcd-rmvb][48集]

584filesindirfftproot连续剧[2005.03.30][tvb][新同居关系][粤语][dvd-rmvb][13集]

________________________________________________________________________________

_______________________________________________________________________________

Sorteddirlistbydownloadedsizefrom01Apr05000009to01Apr05235958

_______________________________________________________________________________

122032.36MBfordireftproottv2[2005.02.18][韩国][大长今][韩语中文][dvd-rmvb][54集]

216360.31MBfordirfftproot连续剧[2005.03.08][韩国][浪漫满屋][韩语中文字幕][dvd-rmvb][16集]

313767.66MBfordirfftproot连续剧[2005.03.14][tvb][御用闲人][粤语][dvd-rmvb][20集]

412257.79MBfordirfftproot连续剧[2005.03.30][tvb][新同居关系][粤语][dvd-rmvb][13集]

511322.49MBfordirfftproot连续剧[2005.03.11][国产][铁齿铜牙纪晓岚3][国语][vcd-rmvb][48集]

________________________________________________________________________________

示例四:

统计IP访问情况。

可对独立IP的登陆次数,或者下载数据量,或上传数据量进行排序,也可以计算出访问的独立IP数,注意这个统计对系统资源占用较大,并且需要花一定时间(如果你的logfile很大的话),这一步统计比以上任何一步需要的时间都要多。

sustatredjnuredjnu050401.log-h

sustatredjnuredjnu050401.log-H

小写h表示以下载量排序,大些H表示以登陆次数进行排序。

输出结果类似:

HostnameConxDfileDMBD%UFileUMBU%

________________________________________________________________________________________________

1219.222.19.593496543.314.46%00.000.00%

2222.200.53.7412295686.563.88%00.000.00%

3222.200.52.275205083.283.46%00.000.00%

4219.222.22.719234226.602.88%10.000.00%

5202.116.28.9246254087.462.79%00.000.00%

6218.192.30.843183538.532.41%00.000.00%

7222.200.53.169161163165.182.16%00.000.00%

8219.222.20.305132956.312.01%3539.5826.79%

9222.200.37.11313202925.441.99%00.000.00%

10222.200.46.2045182925.041.99%00.000.00%

好了,一般常用的参数主要也就这几个,而我们需要实现的功能也基本达到了。

问题是,以上命令怎么用,在哪里输入,怎么得到输出结果。

如果你熟悉命令行操作的话,你可以通过打开命令行模式,再切换到sustat所在目录,然后输入以上命令,得到结果,但是每次都这样做实在是太烦了,还要记一大堆命令。

我有更加简便的效率提升方法,使用批处理文件。

首先将sustat的主程序和需要分析的logfile准备好,主程序包括sustat.exe和cygwin1.dll两个文件,解压即可使用。

下面我们在程序目录下面新建两个目录,一个叫redjnu,用来存放logfile,另外一个叫report,用来存放输出结果。

logfile的路经如redjnuredjnu050401.log这样。

然后新建一个文本文档,在里面输入如下内容:

引用

@echooff

echo生成基本统计报告...

sustatredjnuredjnu050401.log>>reportredjnu050401.txt

echo基本统计报告完成.

echo生成按文件下载次数的统计报告...

sustatredjnuredjnu050401.log-f0>>reportredjnu050401.txt

echo按文件下载次数统计报告完成.

echo生成下载目录统计报告(按文件数)...

sustatredjnuredjnu050401.log-d0>>reportredjnu050401.txt

echo下载目录统计报告完成.

echo生成下载目录统计报告(按下载量)...

sustatredjnuredjnu050401.log-D0>>reportredjnu050401.txt

echo下载目录统计报告完成.

echo生成IP统计报告...

sustatredjnuredjnu050401.log-h>>reportredjnu050401.txt

echoIP统计报告完成.

echo所有统计已经完成。

请查看输出文件.

然后将文件保存为ftplog.bat注意扩展名是bat类型,表示可执行批处理文件。

上面的蓝色部分表示需要分析的logfile的路经,紫色的部分表示输出报告的文件。

上面的方法是对同一个logfile执行四个不同的分析统计任务,然后将结果输出到同一个文件上,你可以在里面添加更多的命令用来同时分析更多的任务。

然后双击一下该批处理文件,屏幕会闪现出几个字,然后很快就会消失,你再去report目录就可以看到报告已经生成了。

由于本人对bat批处理程序的编写的认识极其有限,所以上面的部分写得有点罗嗦,事实上通过bat批处理的编程功能完全可以写出更加简洁更加自动化的功能。

当然这是另外的问题了。

本人一直都在寻找统计FTP下载情况的方法,但是我们用的Serv-U自身并不带有这个功能,只能通过logfile的分析进行统计,我在Serv-U的官方主页上面看到有介绍几个专门分析logfile的工具,其中也有windows模式运行的,但是不是效率太低就是功能达不到我的要求。

sustat虽然在用户界面方面不足,但是功能却是很强大的,而且效率也很高。

希望日后有人能够将他的界面完善。

最后附上包括sustat主程序以及一个示例logfile,一个完整的输出报告,以及我上面所介绍的批处理文件的压缩包,仅供试用。

Ghoul@FunShow暨南风

2005.04.06

附:

sustat官方说明文档(所有命令参数的说明)

都是很简单的英文,我就不翻译了,我的英语也够烂的了-.-!

sustatV2.00

NAME

sustat-displaystatisticsfortheServ-UFtpServer

DESCRIPTION

Thismanualpagedocumentsthesustatcommandwhichanalysethelogfile

oftheServ-UFtpServerandoutputanASCIIreport.

Statisticscanbeonusers,files,directoriesorhosts.

SYNOPSIS

sustatlogfile

[-s<start>ortoday[+-<n>]]

[-e<end>ortoday[+-<n>]]

[-d-D<number_of_dirs>]

[-f<nb_of_files>]

[-h-H]

[-l<user>]

[-r<user>]

[-o<user>]

[-x<excludefile>]

[-u]

[-a]

[-t]

[-m<memorysize>]

[-debug]

[-warn]

[-v]

DESCRIPTION

Thismanualpagedocumentsthesustatcommandwhichanalysethelogfile

oftheServ-UFtpServerandoutputanASCIIreport.

OPTIONS

logfilepathnameoftheServ-Ulogfiletoanalyse.

-s<start>StartDateofAnalyse,informatYYYYMMDD

ifnoneisgiven,thenAnalysestartsinthe1stline

ofthelogfile.

Youcanalsoprovideadaterelativetotoday

forexampleyoucanprovidetodayortoday-1(ieyesterday)

-e<end>EndDateofAnalyse,informatYYYMMDD

ifnoneisgiven,thenanalyseendsinthelastline

ofthelogfile.

Youcanalsoprovideadaterelativetotoday

forexampleyoucanprovidetodayortoday-1(ieyesterday)

-f<n>ifspecified,thereportwillnotbeonusersbutonfiles.

Thiswilloutputthelistofthenmostdownloadedfiles.

ifyouspecify0asnthenallfileswillbedisplayed.

-d<n>ifspecified,thereportwillnotbeonusersbutondirectories.

Thiswilloutputthelistofthenmostdownloadeddirectories

usingnumberoffilesdownloadedbydirectory

ifyouspecify0asnthenalldirectorieswillbedisplayed.

-D<n>ifspecified,thereportwillnotbeonusersbutondirectories.

Thiswilloutputthelistofthenmostdownloadeddirectories

usingnumberofbytesdownloadedbydirectory

ifyouspecify0asnthenalldirectorieswillbedisplayed.

-hifspecified,thereportwillnotbeonusersbuthosts.

Thiswilloutputthelistofallconnectedhosts

sortingthemusingdownloadvolume.

(ifyouwanttosortusinguploadvolumeadd-uoption)

-Hifspecified,thereportwillnotbeonusersbuthosts.

Thiswilloutputthelistofallconnectedhosts

sortingthemusingnumberoflogins.

-uifspecified,thesortorderforstatisticswillbe

uploadedvolumesinsteadofdownloadedvolumes.

-aBydefault,Sustatignoresabortedtransfers(uploadanddownloads)

Ifspecified,Sustatwillcountbytesofabortedtransfers.

-tBydefault,Sustatdoesnotshowconnectionstimes.

Ifspecified,SustatshowtheminformatHHMMSS

-l<user>ifspecified,thereportwillnotbeonusersbutontheconnections

listofthespecifieduser.Ifspecifyallasuserthen

theconnectionlistofalltheuserswillbedisplayed.

-r<user>ifspecified,thereportwillnotbeonusersbutonthe

rejectedconnexionslistofthespecifieduser.Ifspecifyallas

userthentheconnexionlistofalltheuserswillbedisplayed.

-o<user>ifspecified,Sustatwilloutputallloglinesrelatedtothespecifieduser.

Thisisusefultogeneratealogfileforaspecificuser.

-x<file>Ifspecified,thenallusernameslistedinthefile

<file>willbeignoredforstatistics.

Theformatofexcludefileissimplyoneusernamebyline.

-m<n>Bydefault,Sustatallocateinmemory10,000reportsentries.

Thusreportsarelimitedto10,000entries.

Ifyouprocessahugelogfilewhichgenerateareportlarger

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1