server-root/extras/log_anly 目录包含通过 Server Manager 用户界面运行的日志分析工具。此日志分析程序仅分析通用日志格式的文件。log_anly 目录中的 HTML 文档介绍了此工具的参数。server-install/extras/flexanlg 目录包含灵活日志文件格式的命令行日志分析程序。但是默认情况下,Server Manager 使用灵活日志文件报告工具,无论选择了哪种日志文件格式,都是如此。
使用日志分析程序可以生成有关默认服务器的统计信息,例如活动摘要、最常访问的 URL、一天中访问服务器的高峰时段等等。可以从 Proxy Server 或命令行运行日志分析程序。
在尝试运行 flexanlg 命令行实用程序之前必须设置库路径。各种平台的设置如下所示:
Solaris 和 Linux:
LD_LIBRARY_PATH=server-root/bin/proxy/lib:$LD_LIBRARY_PATH
AIX:
LIBPATH=server-root/bin/proxy/lib:$LIBPATH
HP-UX:
SHLIB_PATH=server-root/bin/proxy/lib:$SHLIB_PATH
Windows:
path=server-root\\bin\\proxy\\bin;%path%
在运行日志分析程序之前,应归档服务器日志。有关归档服务器日志的更多信息,请参见将日志文件归档。
还可以在转到 server-root/proxy-serverid 目录后,在命令提示符上键入 ./start -shell,这样就不必设置库路径。
如果使用扩展日志格式或扩展 2 日志格式,日志分析程序将在输出文件中生成除了所指定要报告的信息外,还会生成多个报告。以下部分介绍了这些报告。
传送时间分布报告说明了代理服务器用于传送请求的时间。此报告显示按服务时间和完成的百分比分类的信息。以下示例是一个传送时间分布报告样例。
By service time category:
< 1 sec [644%] ........................................
< 2 sec [33.3%] ....................
< 3 sec [ 2.7%] .
< 4 sec [ 1.7%] .
< 5 sec [ 0.6%]
< 6 sec [ 0.4%]
< 7 sec [ 0.2%]
< 8 sec [ 0.0%]
< 9 sec [ 0.0%]
By percentage finished:
< 1 sec [64.4%] ........................................
< 2 sec [97.7%] ....................................
< 3 sec [100.4%]..............................................
数据流报告说明了从客户机到代理、代理到客户机、代理到远程服务器和远程服务器到代理的数据流(已传送的字节数)。对于这每一种情况,报告都将以标头和内容的形式说明已传送的数据量。数据流报告还说明了从高速缓存到客户机的数据流。以下是一个数据流报告样例。
状态码报告说明了代理服务器从远程服务器接收和发送到客户机的状态码以及数量。状态码报告还提供了所有这些状态码的解释。以下示例是一个状态码报告样例。
请求和连接报告说明了代理服务器从客户机接收的请求数,代理向远程服务器请求的连接数(初始检索、最新版本检查和刷新),以及代理服务器使用高速缓存的文档而避免的远程连接数。以下示例是一个请求和连接报告样例。
- Total requests............. 478 - Remote connections......... 439 - Avoided remote connects.... 39 [ 8.2%]
高速缓存性能报告说明了客户机的高速缓存、代理服务器的高速缓存以及直接连接的性能。
当客户机对文档执行最新版本检查,而远程服务器将返回一条 304 消息,通知客户机文档未修改时,即发生了客户机高速缓存命中。客户机启动的最新版本检查表明,客户机的高速缓存中包含文档的独立副本。
对于客户机的高速缓存,报告将说明:
Client and proxy cache hits:代理服务器和客户机都具有所请求文档的副本,查询远程服务器进行关于代理副本的最新版本检查,然后对客户机的请求进行关于代理副本的评估时的高速缓存命中。高速缓存性能报告说明了代理提供服务的此类型的请求数,以及代理为这些请求提供服务花费的平均时间数。
Proxy shortcut no-check:代理服务器和客户机都具有所请求文档的副本,代理服务器在未检查远程服务器的情况下,通知客户机其高速缓存中的文档为最新版本时的客户机高速缓存命中。高速缓存性能报告说明了代理提供服务的此类型的请求数,以及用于为这些请求提供服务的平均时间。
Client cache hits only:仅客户机具有所请求文档的高速缓存副本时的客户机高速缓存命中。在此类型的请求中,代理服务器直接对客户机的 If-modified-since GET 标头进行通道操作。高速缓存性能报告说明了代理提供服务的此类型的请求数,以及用于为这些请求提供服务的平均时间。
Total client cache hits:客户机高速缓存命中的总次数,以及用于为这些请求提供服务的平均时间。
客户机从代理服务器请求文档,而代理服务器的高速缓存中已包含该文档时,将发生代理高速缓存命中。对于代理服务器的高速缓存命中,该报告将显示:
Proxy cache hits with check:代理服务器查询远程服务器,从而对文档进行最新版本检查时的高速缓存命中。高速缓存性能报告说明了代理提供服务的此类型的请求数,以及用于为这些请求提供服务的平均时间。
Proxy cache hits without check:代理服务器未查询远程服务器以进行文档的最新版本检查情况下的高速缓存命中。高速缓存性能报告说明了代理提供服务的此类型的请求数,以及用于为这些请求提供服务的平均时间。
pure proxy cache hits:客户机没有所请求文档的高速缓存副本时的代理高速缓存命中。高速缓存性能报告说明了代理提供服务的此类型的请求数,以及用于为这些请求提供服务的平均时间。
对于组合的代理高速缓存命中次数,报告说明了命中代理服务器的高速缓存的总次数,以及为这些请求提供服务花费的平均时间。
直接事务是指直接从远程服务器进入代理服务器,然后到客户机,而没有发生任何高速缓存命中的事务。对于直接事务,报告将显示:
Retrieved documents:直接从远程服务器检索的文档数。高速缓存性能报告说明了代理提供服务的此类型的请求数,为这些请求提供服务花费的平均时间,以及总事务的百分比。
Other transactions:返回的状态码不是 200 或 304 的事务。高速缓存性能报告说明了代理提供服务的此类型的请求数,以及为这些请求提供服务花费的平均时间。
Total direct traffic:请求数,包括失败的请求和成功检索的文档(直接从客户机进入远程服务器的文档)。高速缓存性能报告说明了代理提供服务的此类型的请求数,用于为这些请求提供服务的平均时间,以及总事务的百分比。
以下示例是一个高速缓存性能报告样例。
CLIENT CACHE: - Client & proxy cache hits... 86 reqs [18.0%] 0.21 sec/req- Proxy shortcut no-check........ 13 reqs [ 2.7%] 0.00 sec/req- Client cache hits only..... - TOTAL client cache hits.......... 99 reqs [20.7%] 0.18 sec/req PROXY CACHE: - Proxy cache hits w/check........ 4 reqs [ 0.8%] 0.50 sec/req- Proxy cache hits w/o check.. 10 reqs [ 2.1%] 0.00 sec/req- Pure proxy cache hits...... 14 reqs [ 2.9%] 0.14 sec/req PROXY CACHE HITS COMBINED: - TOTAL proxy cache hits....... 113 reqs [23.6%] 0.18 sec/req DIRECT TRANSACTIONS: - Retrieved documents..313 reqs [65.5%] 0.90 sec/req 2 MB- Other transactions.. 52 reqs [10.9%] 7.79 sec/req- TOTAL direct traffic.. 365 reqs [76.4%] 1.88 sec/req 2 MB |
传送时间报告说明了有关代理服务器用于处理事务的时间的信息。此报告说明了以下分类的值:
Average transaction time:记录的所有传送时间的平均值。
Average transfer time without caching:不是从高速缓存返回的事务(即导致远程服务器作出 200 响应的那些事务)的平均传送时间。
Average with caching, without errors:所有非错误事务(即那些状态码为 2xx 和 3xx 的事务)的平均传送时间。
Average transfer time improvement:平均事务时间与进行高速缓存且没有错误时平均传送时间之差。
以下示例是一个传送时间报告样例。
- Average transaction time... 1.48 sec/req- Ave xfer time w/o caching.. 0.90 sec/req- Ave w/caching, w/o errors.. 0.71 sec/req - Ave xfer time improvement.. 0.19 sec/req
对于进行了分析的每一小时,每小时活动报告将说明:
平均加载次数
未对远程服务器进行最新版本检查时的高速缓存命中次数
对远程服务器进行最新版本检查,证明文档为最新版本且在客户机高速缓存中存在时,命中代理服务器的高速缓存的次数
对远程服务器进行最新版本检查,证明文档为最新版本但不存在于客户机高速缓存中时,命中代理服务器的高速缓存的次数
对远程服务器进行最新版本检查,导致更新了部分文档时,命中代理服务器的高速缓存的次数
对远程服务器进行最新版本检查,返回了状态码为 200 的所请求文档的新副本时,命中代理服务器的高速缓存的次数
直接从远程服务器检索文档,没有发生代理服务器的任何高速缓存命中的请求数
此时将显示 "Generate Report" 页面。
键入服务器的名称。此名称将显示在生成的报告中。
选择报告将以 HTML 格式还是 ASCII 格式显示。
选择要分析的日志文件。
如果要将结果保存到文件中,请在 "Output File" 字段中键入一个输出文件名。
如果保留该字段为空,报告结果将会列显到屏幕上。对于较大的日志文件,应将结果保存到文件中,因为将输出列显到屏幕上可能需要较长时间。
选择是否为某些服务器统计信息生成总计。
可以生成以下总计:
Total Hits- 启用访问日志后,服务器收到的命中总数。
304 (Not Modified) Status Codes- 使用所请求文档的本地副本而不是服务器返回页面的次数。
302 (Redirects) Status Codes- 由于原始 URL 被转移,服务器重定向到新 URL 的次数。
404 (Not Found) Status Codes- 服务器找不到所请求的文档,或者由于客户机不是授权用户,服务器未对文档提供服务的次数。
500 (Server Error) Status Codes- 发生服务器相关错误的次数。
Total Unique URLs- 启用访问日志后访问的唯一 URL 的数量。
Total Unique Hosts- 启用访问日志后,访问了服务器的唯一主机的数量。
Total Kilobytes Transferred- 启用了访问日志后,服务器传送的字节数(以 KB 为单位)。
选择是否生成常规统计信息。如果选择生成统计信息,请选择以下选项:
Find Top Number Seconds Of Log- 基于最近几秒钟内的信息生成统计信息。
Find Top Number Minutes Of Log-
基于最近几分钟内的信息生成统计信息。
Find Top Number Hours Of Log- 基于最近几小时内的信息生成统计信息。
Find Number Users (If Logged)- 基于用户数信息生成统计信息。
Find Top Number Referers (If Logged)- 基于引用站点数量信息生成统计信息。
Find Top Number User Agents (If Logged)- 基于有关用户代理的信息(例如浏览器类型、浏览器版本以及操作系统)生成统计信息。
Find Top Number Miscellaneous Logged Items (If Logged)- 基于用户数信息生成统计信息。
选择是否生成列表。
如果选择了生成列表,请指定要生成列表的项:
URLs Accessed- 显示访问的 URL
Number Most Commonly Accessed URL- 显示最常访问的 URL 或访问超过指定次数的 URL
URLs That Were Accessed More Than Number Times- 显示访问超过指定次数的 URL
Hosts Accessing Your Server- 显示访问了 Proxy Server 的主机
Number Hosts Most Often Accessing Your Server- 显示访问服务器最频繁的主机,或者已访问服务器超过指定次数的主机
Hosts That Accessed Your Server More Than Number Times- 显示访问服务器超过指定次数的主机
指定要查看结果的顺序
按照希望各部分在报告中的顺序,赋予从 1 至 3 的优先级。如果选择不生成其中的任一项的优先级,该部分将自动被忽略。这些部分包括:
查找总计
常规统计信息
生成列表
单击 "OK"。
报告将显示在新窗口中。
要通过命令行分析访问日志文件,请运行 server-install/extras/flexanlg 目录下的 flexanlg 工具。
要运行 flexanlg,请在命令提示符处键入以下命令和选项:
./flexanlg [-n name] [-x] [-r] [-p order] [-i file]* [ -m metafile ]* [-o file][-c opts] [-t opts] [-l opts]
标记了 * 的选项可以重复。
You can display this information online by typing ./flexanlg -h.
-P: proxy log format Default: no -n servername: The name of the server -x : Output in HTML Default: no -r : Resolve IP addresses to hostnames Default: no -p [c,t,l]: Output order (counts, time stats, lists) Default: ctl -i filename: Input log file Default: none -o filename: Output log file Default: stdout -m filename: Meta file Default: none -c [h,n,r,f,e,u,o,k,c,z]: Count these item(s) - Default: hnreuokc h: total hits n: 304 Not Modified status codes (Use Local Copy) r: 302 Found status codes (Redirects) f: 404 Not Found status codes (Document Not Found) e: 500 Server Error status codes (Misconfiguration) u: total unique URL’s o: total unique hosts k: total kilobytes transferred c: total kilobytes saved by caches z: Do not count any items. -t [sx,mx,hx, xx,z]: Find time stats - Default:s5m5h10u10a10r10x10 s(number): Find top (number) seconds of log m(number): Find top (number) minutes of log h(number): Find top (number) hours of log u(number): Find top (number) users of log a(number): Find top (number) user agents of log r(number): Find top (number) referers of log x(number): Find top (number) for miscellaneous keywords z: Do not find any time stats. -l [cx,hx]: Make a list of - Default: c+3h5 c(x,+x): Most commonly accessed URL’s (x: Only list x entries) (+x: Only list if accessed more than x times) h(x,+x): Hosts (or IP addresses) most often accessing your server (x: Only list x entries) (+x: Only list if accessed more than x times) z: Do not make any lists. |