apache log格式设置
LogFormat 可以用的格式串有(转自:http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats):
%% | The percent sign | ||||||
%a | Remote IP-address | ||||||
%a | Local IP-address | ||||||
%B | Size of response in bytes, excluding HTTP headers. | ||||||
%B | Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '- ' rather than a 0 when no bytes are sent. | ||||||
%{<var>Foobar</var>}C | The contents of cookie Foobar in the request sent to the server. Only version 0 cookies are fully supported. | ||||||
%D | The time taken to serve the request, in microseconds. | ||||||
%{<var>FOOBAR</var>}e | The contents of the environment variable FOOBAR | ||||||
%f | Filename | ||||||
%h | Remote host | ||||||
%h | The request protocol | ||||||
%{<var>Foobar</var>}i | The contents of <var>Foobar</var>: header line(s) in the request sent to the server. Changes made by other modules (e.g. <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4JyspCeF0o9cAq281PJoYaAkn0lis4dXE6Nbo2OBHsUtyFQ/" rel="nofollow" title="mod_headers">mod_headers</a> ) affect this. If you're interested in what the request header was prior to when most modules would have modified it, use <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4JytaTqvUm0bvjeHwCcvOypmLfGJiYYBF5V50qX_QWnQdsQ/" rel="nofollow" title="mod_setenvif">mod_setenvif</a> to copy the header into an internal environment variable and log that value with the %{<var>VARNAME</var>}e described above. | ||||||
%k | Number of keepalive requests handled on this connection. Interesting if <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4JysfRUwyb4ZXRw7u6RXgWDo3JQ25KstfPAto3gVlH26mAQ/" rel="nofollow" title="KeepAlive">KeepAlive</a> is being used, so that, for example, a '1' means the first keepalive request after the initial one, '2' the second, etc...; otherwise this is always 0 (indicating the initial request). Available in versions 2.2.11 and later. | ||||||
%l | Remote logname (from identd, if supplied). This will return a dash unless <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4JyvAGJtVGj2Z-HM9x7ijUPt5I6x9mfSFmFz2o8iQdfONCA/" rel="nofollow" title="mod_ident">mod_ident</a> is present and <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4JyvAGJtVGj2Z-HM9x7ijUPt5UDLpBExz7Sq3Cd-_2prYuI-6ihybz4IjyhSkJuGdsS8/" rel="nofollow" title="IdentityCheck">IdentityCheck</a> is set On . | ||||||
%m | The request method | ||||||
%{<var>Foobar</var>}n | The contents of note Foobar from another module. | ||||||
%{<var>Foobar</var>}o | The contents of <var>Foobar</var>: header line(s) in the reply. | ||||||
%p | The canonical port of the server serving the request | ||||||
%{<var>format</var>}p | The canonical port of the server serving the request or the server's actual port or the client's actual port. Valid formats are canonical , local , orremote . | ||||||
%p | The process ID of the child that serviced the request. | ||||||
%{<var>format</var>}p | The process ID or thread id of the child that serviced the request. Valid formats are pid , tid , and hextid . hextid requires APR 1.2.0 or higher. | ||||||
%q | The query string (prepended with a ? if a query string exists, otherwise an empty string) | ||||||
%r | First line of request | ||||||
%r | The handler generating the response (if any). | ||||||
%s | Status. For requests that got internally redirected, this is the status of the *original* request --- %>s for the last. | ||||||
%t | Time the request was received (standard english format) | ||||||
%{<var>format</var>}t | The time, in the form given by format, which should be in strftime(3) format. (potentially localized) | ||||||
%t | The time taken to serve the request, in seconds. | ||||||
%u | Remote user (from auth; may be bogus if return status (%s ) is 401) | ||||||
%u | The URL path requested, not including any query string. | ||||||
%v | The canonical <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4JysUpy8nlBZG984nr5f_Tm1zp9nhlx3pgVTqgcUHNYZPxA/" rel="nofollow" title="ServerName">ServerName</a> of the server serving the request. | ||||||
%v | The server name according to the <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4Jyt59O8qqYprHl3M41t-aalPiSd8SBotu2Rid7pAlFKT7w/" rel="nofollow" title="UseCanonicalName">UseCanonicalName</a> setting. | ||||||
%X | Connection status when response is completed:
(This directive was | ||||||
%I | Bytes received, including request and headers, cannot be zero. You need to enable <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4JyuyzLoKsQdhnDI5yLRNKde4I6x9mfSFmFz2o8iQdfONCA/" rel="nofollow" title="mod_logio">mod_logio</a> to use this. | ||||||
%O | Bytes sent, including headers, cannot be zero. You need to enable <a target="_blank" href="https://www.ancii.com/link/v1/RwKZkA6CG-l-AqoRHz5CD1VWpNiX66HHaypWtzr4JyuyzLoKsQdhnDI5yLRNKde4I6x9mfSFmFz2o8iQdfONCA/" rel="nofollow" title="mod_logio">mod_logio</a> to use this. |
日志格式示例:
"%t [%r] %>s %h %a %v %D %b [%{User-Agent}i] [%{Referer}i --> %U]"
相关推荐
冰蝶 2020-06-05
pigsmall 2020-11-19
SXIAOYI 2020-09-16
Ladyseven 2020-07-25
whileinsist 2020-06-24
gufudhn 2020-06-12
LinuxAndroidAI 2020-06-04
supperme 2020-05-28
yaodilu 2020-05-10
e度空间 2020-04-27
云端漂移 2020-04-09
peterwzc 2020-03-17
有心就有方向 2012-09-03
ebuild 2013-05-14
donghedonghe 2013-05-31
tdeclipse 2011-02-28
linuxprobe0 2013-04-15
linuxprobe0 2013-04-01