Sun Java System Web Proxy Server 4.0.8 管理指南

使用日志分析程序

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%]..............................................

数据流报告

数据流报告说明了从客户机到代理、代理到客户机、代理到远程服务器和远程服务器到代理的数据流(已传送的字节数)。对于这每一种情况,报告都将以标头和内容的形式说明已传送的数据量。数据流报告还说明了从高速缓存到客户机的数据流。以下是一个数据流报告样例。

 
Headers
Content
Total
- Client -> Proxy.........
0 MB
0 MB
0 MB
- Proxy  -> Client...........
0 MB
2 MB
3 MB
- Proxy  -> Remote...........
0 MB
0 MB
0 MB
- Remote -> Proxy..........
0 MB
2 MB
2 MB
       
Approx:
     
- Cache  -> Client...........
0 MB
0 MB
0 MB

状态码报告

状态码报告说明了代理服务器从远程服务器接收和发送到客户机的状态码以及数量。状态码报告还提供了所有这些状态码的解释。以下示例是一个状态码报告样例。

Code
-From remote-
 
-To client-
-Explanation-
200
338  [70.7%]
352  [73.6%]
OK
302
33  [ 6.9%]
36  [ 7.5%]
Redirect
304
90  [18.8%]
99  [20.7%]
Not modified
404
3  [ 0.6%]
3  [ 0.6%]
Not found
407
 
5  [ 1.0%]
Proxy authorization required
500
 
2  [ 0.4%]
Internal server error
504
 
6  [ 1.3%]
Gateway timeout

请求和连接报告

请求和连接报告说明了代理服务器从客户机接收的请求数,代理向远程服务器请求的连接数(初始检索、最新版本检查和刷新),以及代理服务器使用高速缓存的文档而避免的远程连接数。以下示例是一个请求和连接报告样例。

- Total requests.............     478
- Remote connections.........     439
- Avoided remote connects....      39 [ 8.2%]

高速缓存性能报告

高速缓存性能报告说明了客户机的高速缓存、代理服务器的高速缓存以及直接连接的性能。

客户机高速缓存

当客户机对文档执行最新版本检查,而远程服务器将返回一条 304 消息,通知客户机文档未修改时,即发生了客户机高速缓存命中。客户机启动的最新版本检查表明,客户机的高速缓存中包含文档的独立副本。

对于客户机的高速缓存,报告将说明:

代理高速缓存

客户机从代理服务器请求文档,而代理服务器的高速缓存中已包含该文档时,将发生代理高速缓存命中。对于代理服务器的高速缓存命中,该报告将显示:

组合的代理高速缓存命中次数

对于组合的代理高速缓存命中次数,报告说明了命中代理服务器的高速缓存的总次数,以及为这些请求提供服务花费的平均时间。

直接事务

直接事务是指直接从远程服务器进入代理服务器,然后到客户机,而没有发生任何高速缓存命中的事务。对于直接事务,报告将显示:

以下示例是一个高速缓存性能报告样例。


                  
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

每小时活动报告

对于进行了分析的每一小时,每小时活动报告将说明:

Procedure从 Server Manager 运行日志分析程序

  1. 访问 Server Manager,然后单击 "Server Status" 选项卡。

  2. 单击 "Generate Report" 链接。

    此时将显示 "Generate Report" 页面。

  3. 键入服务器的名称。此名称将显示在生成的报告中。

  4. 选择报告将以 HTML 格式还是 ASCII 格式显示。

  5. 选择要分析的日志文件。

  6. 如果要将结果保存到文件中,请在 "Output File" 字段中键入一个输出文件名。

    如果保留该字段为空,报告结果将会列显到屏幕上。对于较大的日志文件,应将结果保存到文件中,因为将输出列显到屏幕上可能需要较长时间。

  7. 选择是否为某些服务器统计信息生成总计。

    可以生成以下总计:

    • 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 为单位)。

  8. 选择是否生成常规统计信息。如果选择生成统计信息,请选择以下选项:

    • 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)- 基于用户数信息生成统计信息。

  9. 选择是否生成列表。

    如果选择了生成列表,请指定要生成列表的项:

    • 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- 显示访问服务器超过指定次数的主机

  10. 指定要查看结果的顺序

    按照希望各部分在报告中的顺序,赋予从 1 至 3 的优先级。如果选择不生成其中的任一项的优先级,该部分将自动被忽略。这些部分包括:

    • 查找总计

    • 常规统计信息

    • 生成列表

  11. 单击 "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.