⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_log_config.html.en

📁 Apache官方在今天放出产品系列2.2的最新版本2.2.11的源码包 最流行的HTTP服务器软件之一
💻 EN
📖 第 1 页 / 共 2 页
字号:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX              This file is generated from xml source: DO NOT EDIT        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX      --><title>mod_log_config - Apache HTTP Server</title><link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link href="../images/favicon.ico" rel="shortcut icon" /></head><body><div id="page-header"><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.2</p><img alt="" src="../images/feather.gif" /></div><div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Modules</a></div><div id="page-content"><div id="preamble"><h1>Apache Module mod_log_config</h1><div class="toplang"><p><span>Available Languages: </span><a href="../en/mod/mod_log_config.html" title="English">&nbsp;en&nbsp;</a> |<a href="../ja/mod/mod_log_config.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |<a href="../ko/mod/mod_log_config.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |<a href="../tr/mod/mod_log_config.html" hreflang="tr" rel="alternate" title="T黵k鏴">&nbsp;tr&nbsp;</a></p></div><table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Logging of the requests made to the server</td></tr><tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr><tr><th><a href="module-dict.html#ModuleIdentifier">Module營dentifier:</a></th><td>log_config_module</td></tr><tr><th><a href="module-dict.html#SourceFile">Source燜ile:</a></th><td>mod_log_config.c</td></tr></table><h3>Summary</h3>    <p>This module provides for flexible logging of client    requests. Logs are written in a customizable format, and may be    written directly to a file, or to an external program.    Conditional logging is provided so that individual requests may    be included or excluded from the logs based on characteristics    of the request.</p>    <p>Three directives are provided by this module:    <code class="directive"><a href="#transferlog">TransferLog</a></code> to create    a log file, <code class="directive"><a href="#logformat">LogFormat</a></code>    to set a custom format, and <code class="directive"><a href="#customlog">CustomLog</a></code> to define a log file and format in one    step. The <code class="directive">TransferLog</code> and <code class="directive">CustomLog</code> directives can be used multiple times in each    server to cause each request to be logged to multiple files.</p></div><div id="quickview"><h3 class="directives">Directives</h3><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#bufferedlogs">BufferedLogs</a></li><li><img alt="" src="../images/down.gif" /> <a href="#cookielog">CookieLog</a></li><li><img alt="" src="../images/down.gif" /> <a href="#customlog">CustomLog</a></li><li><img alt="" src="../images/down.gif" /> <a href="#logformat">LogFormat</a></li><li><img alt="" src="../images/down.gif" /> <a href="#transferlog">TransferLog</a></li></ul><h3>Topics</h3><ul id="topics"><li><img alt="" src="../images/down.gif" /> <a href="#formats">Custom Log Formats</a></li><li><img alt="" src="../images/down.gif" /> <a href="#security">Security Considerations</a></li></ul><h3>See also</h3><ul class="seealso"><li><a href="../logs.html">Apache Log Files</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="formats" id="formats">Custom Log Formats</a></h2>    <p>The format argument to the <code class="directive"><a href="#logformat">LogFormat</a></code> and <code class="directive"><a href="#customlog">CustomLog</a></code> directives is a string. This string is    used to log each request to the log file. It can contain literal    characters copied into the log files and the C-style control    characters "\n" and "\t" to represent new-lines and tabs.    Literal quotes and back-slashes should be escaped with    back-slashes.</p>    <p>The characteristics of the request itself are logged by    placing "<code>%</code>" directives in the format string, which are    replaced in the log file by the values as follows:</p>    <table class="bordered"><tr class="header"><th>Format&nbsp;String</th>        <th>Description</th></tr><tr><td><code>%%</code></td>        <td>The percent sign</td></tr><tr class="odd"><td><code>%a</code></td>        <td>Remote IP-address</td></tr><tr><td><code>%A</code></td>        <td>Local IP-address</td></tr><tr class="odd"><td><code>%B</code></td>        <td>Size of response in bytes, excluding HTTP headers.</td></tr><tr><td><code>%b</code></td>        <td>Size of response in bytes, excluding HTTP headers. In CLF format, <em>i.e.</em>        a '<code>-</code>' rather than a 0 when no bytes are sent.</td></tr><tr class="odd"><td><code>%{<var>Foobar</var>}C</code></td>        <td>The contents of cookie <var>Foobar</var> in the request sent        to the server.</td></tr><tr><td><code>%D</code></td>        <td>The time taken to serve the request, in microseconds.</td></tr><tr class="odd"><td><code>%{<var>FOOBAR</var>}e</code></td>        <td>The contents of the environment variable        <var>FOOBAR</var></td></tr><tr><td><code>%f</code></td>        <td>Filename</td></tr><tr class="odd"><td><code>%h</code></td>        <td>Remote host</td></tr><tr><td><code>%H</code></td>        <td>The request protocol</td></tr><tr class="odd"><td><code>%{<var>Foobar</var>}i</code></td>        <td>The contents of <code><var>Foobar</var>:</code> header line(s)        in the request sent to the server. Changes made by other        modules (e.g. <code class="module"><a href="../mod/mod_headers.html">mod_headers</a></code>) affect this.        </td></tr><tr><td><code>%k</code></td>        <td>Number of keepalive requests handled on this connection.  Interesting if          <code class="directive"><a href="../mod/core.html#keepalive">KeepAlive</a></code> 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).</td></tr><tr class="odd"><td><code>%l</code></td>        <td>Remote logname (from identd, if supplied). This will return a        dash unless <code class="module"><a href="../mod/mod_ident.html">mod_ident</a></code> is present and <code class="directive"><a href="../mod/mod_ident.html#identitycheck">IdentityCheck</a></code> is set        <code>On</code>.</td></tr><tr><td><code>%m</code></td>        <td>The request method</td></tr><tr class="odd"><td><code>%{<var>Foobar</var>}n</code></td>        <td>The contents of note <var>Foobar</var> from another        module.</td></tr><tr><td><code>%{<var>Foobar</var>}o</code></td>        <td>The contents of <code><var>Foobar</var>:</code> header line(s)        in the reply.</td></tr><tr class="odd"><td><code>%p</code></td>        <td>The canonical port of the server serving the request</td></tr><tr><td><code>%{<var>format</var>}p</code></td>        <td>The canonical port of the server serving the request or the        server's actual port or the client's actual port.  Valid formats        are <code>canonical</code>, <code>local</code>, or <code>remote</code>.        </td></tr><tr class="odd"><td><code>%P</code></td>        <td>The process ID of the child that serviced the request.</td></tr><tr><td><code>%{<var>format</var>}P</code></td>        <td>The process ID or thread id of the child that serviced the         request.  Valid formats are <code>pid</code>, <code>tid</code>,        and <code>hextid</code>.  <code>hextid</code> requires APR 1.2.0 or         higher.        </td></tr><tr class="odd"><td><code>%q</code></td>        <td>The query string (prepended with a <code>?</code> if a query        string exists, otherwise an empty string)</td></tr><tr><td><code>%r</code></td>        <td>First line of request</td></tr><tr class="odd"><td><code>%s</code></td>        <td>Status. For requests that got internally redirected, this is        the status of the *original* request --- <code>%&gt;s</code>        for the last.</td></tr><tr><td><code>%t</code></td>        <td>Time the request was received (standard english        format)</td></tr><tr class="odd"><td><code>%{<var>format</var>}t</code></td>        <td>The time, in the form given by format, which should be in        <code>strftime(3)</code> format. (potentially localized)</td></tr><tr><td><code>%T</code></td>        <td>The time taken to serve the request, in seconds.</td></tr><tr class="odd"><td><code>%u</code></td>        <td>Remote user (from auth; may be bogus if return status        (<code>%s</code>) is 401)</td></tr><tr><td><code>%U</code></td>        <td>The URL path requested, not including any query string.</td></tr><tr class="odd"><td><code>%v</code></td>        <td>The canonical <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code>        of the server serving the request.</td></tr><tr><td><code>%V</code></td>        <td>The server name according to the <code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code> setting.</td></tr><tr class="odd"><td><code>%X</code></td>        <td>Connection status when response is completed:        <table>                <tr><td><code>X</code> =</td>            <td>connection aborted before the response completed.</td></tr>        <tr><td><code>+</code> =</td>            <td>connection may be kept alive after the response is            sent.</td></tr>        <tr><td><code>-</code> = </td>            <td>connection will be closed after the response is            sent.</td></tr>        </table>        <p>(This directive was <code>%c</code> in late versions of Apache        1.3, but this conflicted with the historical ssl        <code>%{<var>var</var>}c</code> syntax.)</p></td></tr><tr><td><code>%I</code></td>        <td>Bytes received, including request and headers, cannot be zero.        You need to enable <code class="module"><a href="../mod/mod_logio.html">mod_logio</a></code> to use this.</td></tr><tr class="odd"><td><code>%O</code></td>        <td>Bytes sent, including headers, cannot be zero. You need to        enable <code class="module"><a href="../mod/mod_logio.html">mod_logio</a></code> to use this.</td></tr></table>    <h3><a name="modifiers" id="modifiers">Modifiers</a></h3>      <p>Particular items can be restricted to print only for      responses with specific HTTP status codes by placing a      comma-separated list of status codes immediately following the      "%".  For example, <code>"%400,501{User-agent}i"</code> logs      <code>User-agent</code> on 400 errors and 501 errors only.  For      other status codes, the literal string <code>"-"</code> will be      logged.  The status code list may be preceded by a      "<code>!</code>" to indicate negation:      <code>"%!200,304,302{Referer}i"</code> logs <code>Referer</code>      on all requests that do <em>not</em> return one of the three      specified codes.</p>      <p>The modifiers "&lt;" and "&gt;" can be used for requests that      have been internally redirected to choose whether the original      or final (respectively) request should be consulted.  By      default, the <code>%</code> directives <code>%s, %U, %T,      %D,</code> and <code>%r</code> look at the original request      while all others look at the final request.  So for example,      <code>%&gt;s</code> can be used to record the final status of      the request and <code>%&lt;u</code> can be used to record the      original authenticated user on a request that is internally      redirected to an unauthenticated resource.</p>        <h3><a name="format-notes" id="format-notes">Some Notes</a></h3>      <p>For security reasons, starting with version 2.0.46,      non-printable and other special characters in <code>%r</code>,      <code>%i</code> and <code>%o</code> are escaped using      <code>\x<var>hh</var></code> sequences, where <var>hh</var>      stands for the hexadecimal representation of the raw      byte. Exceptions from this rule are <code>"</code> and      <code>\</code>, which are escaped by prepending a backslash, and      all whitespace characters, which are written in their C-style      notation (<code>\n</code>, <code>\t</code>, etc).  In versions      prior to 2.0.46, no escaping was performed on these strings so      you had to be quite careful when dealing with raw log files.</p>      <p>In httpd 2.0, unlike 1.3, the <code>%b</code> and      <code>%B</code> format strings do not represent the number of      bytes sent to the client, but simply the size in bytes of the      HTTP response (which will differ, for instance, if the      connection is aborted, or if SSL is used).  The <code>%O</code>      format provided by <code class="module"><a href="../mod/mod_logio.html">mod_logio</a></code> will log the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -