1. 程式人生 > >IHS的access_log的日子格式設定

IHS的access_log的日子格式設定

IHS(IBM HTTP Server )的access.log可以記錄http server處理的類,物件的時間,但是不能輸出持續的時間,在效能測試的過程中,如果需要統計http server消耗的時間,就必須要改一下access.log的設定。

以下是access.log的配置檔案httpd.conf的程式碼片段

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

#

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t  \"%r\" %>s %b " common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

#

# The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a <VirtualHost>

# container, they will be logged here.  Contrariwise, if you *do*

# define per-<VirtualHost> access logfiles, transactions will be

# logged therein and *not* in this file.

#

CustomLog logs/access_log common

如果需要輸出持續時間,需要把

LogFormat "%h %l %u %t  \"%r\" %>s %b " common 改為

LogFormat "%h %l %u %t %T \"%r\" %>s %b %T" common

如果需要將access.log按日期和大小分開存放,需要把

CustomLog logs/access_log common改為

CustomLog "|/appl/was/IHS/HTTPServer/bin/rotatelogs /appl/was/IHS/HTTPServer/logs/ls32_access.log%Y%m%d 10M %t" common

最後的httpd.conf即為:

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

#

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t %T \"%r\" %>s %b %T" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

#

# The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a <VirtualHost>

# container, they will be logged here.  Contrariwise, if you *do*

# define per-<VirtualHost> access logfiles, transactions will be

# logged therein and *not* in this file.

#

CustomLog "|/appl/was/IHS/HTTPServer/bin/rotatelogs /appl/was/IHS/HTTPServer/logs/ls32_access.log%Y%m%d 10M %t" common

CustomLog "|/appl/was/IHS/HTTPServer/bin/rotatelogs /appl/was/IHS/HTTPServer/logs/ls32_access.log%Y%m%d 8600 480 " common

apache&IHS的日誌切割方法,只需要修改httpd.conf(conf目錄下)檔案的CustomLog或ErrorLog部分即可,見下: CustomLog “|bin/rotatelogs.exe e:\weblog\access%Y%m%d.log 86400 480″common 或 ErrorLog “|bin/rotatelogs.exe e:\weblog\access%Y%m%d.log 86400 480″ ---------------------  作者:達摩院掃地僧  來源:CSDN  原文:https://blog.csdn.net/yougou_sully/article/details/80419955  版權宣告:本文為博主原創文章,轉載請附上博文連結!