mod_log_config.xml revision 05a9ee8994d646c0067b6ea6ec64551e1e0c56ab
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<?xml version="1.0"?>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<!-- $LastChangedRevision$ -->
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<!--
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye Licensed to the Apache Software Foundation (ASF) under one or more
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye contributor license agreements. See the NOTICE file distributed with
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye this work for additional information regarding copyright ownership.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye The ASF licenses this file to You under the Apache License, Version 2.0
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye (the "License"); you may not use this file except in compliance with
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye the License. You may obtain a copy of the License at
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye http://www.apache.org/licenses/LICENSE-2.0
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye Unless required by applicable law or agreed to in writing, software
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye distributed under the License is distributed on an "AS IS" BASIS,
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye See the License for the specific language governing permissions and
a638f353bad3ee605c93aa9808d707dd8198bf8aKnut Anders Hatlen limitations under the License.
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal-->
a638f353bad3ee605c93aa9808d707dd8198bf8aKnut Anders Hatlen
a638f353bad3ee605c93aa9808d707dd8198bf8aKnut Anders Hatlen<modulesynopsis metafile="mod_log_config.xml.meta">
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<name>mod_log_config</name>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye<description>Logging of the requests made to the server</description>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye<status>Base</status>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<sourcefile>mod_log_config.c</sourcefile>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<identifier>log_config_module</identifier>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye<summary>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye <p>This module provides for flexible logging of client
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok requests. Logs are written in a customizable format, and may be
bef1c30dbcd8f72a02f0a247cabf605f282bbcbdKnut Anders Hatlen written directly to a file, or to an external program.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye Conditional logging is provided so that individual requests may
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal be included or excluded from the logs based on characteristics
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal of the request.</p>
7a147aeccd50900dc20ead611c17ab5728a1a6a6Jorgen Austvik
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok <p>Three directives are provided by this module:
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok <directive module="mod_log_config">TransferLog</directive> to create
eb1776903fd1f998009e97470a65fba8a499a0d9Lubos Kosco a log file, <directive module="mod_log_config">LogFormat</directive>
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST to set a custom format, and <directive module="mod_log_config"
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye >CustomLog</directive> to define a log file and format in one
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye step. The <directive>TransferLog</directive> and <directive
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye >CustomLog</directive> directives can be used multiple times in each
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye server to cause each request to be logged to multiple files.</p>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye</summary>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<seealso><a href="/logs.html">Apache Log Files</a></seealso>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<section id="formats"><title>Custom Log Formats</title>
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST <p>The format argument to the <directive module="mod_log_config"
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye >LogFormat</directive> and <directive module="mod_log_config"
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye >CustomLog</directive> directives is a string. This string is
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye used to log each request to the log file. It can contain literal
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye characters copied into the log files and the C-style control
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal characters "\n" and "\t" to represent new-lines and tabs.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye Literal quotes and backslashes should be escaped with
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye backslashes.</p>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <p>The characteristics of the request itself are logged by
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye placing "<code>%</code>" directives in the format string, which are
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye replaced in the log file by the values as follows:</p>
bef1c30dbcd8f72a02f0a247cabf605f282bbcbdKnut Anders Hatlen
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <table border="1" style="zebra">
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <columnspec><column width=".2"/><column width=".8"/></columnspec>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <tr><th>Format&nbsp;String</th>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <th>Description</th></tr>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <tr><td><code>%%</code></td>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <td>The percent sign.</td></tr>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <tr><td><code>%a</code></td>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <td>Remote IP-address.</td></tr>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <tr><td><code>%A</code></td>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <td>Local IP-address.</td></tr>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <tr><td><code>%B</code></td>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <td>Size of response in bytes, excluding HTTP headers.</td></tr>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <tr><td><code>%b</code></td>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <td>Size of response in bytes, excluding HTTP headers. In CLF format, <em>i.e.</em>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal a '<code>-</code>' rather than a 0 when no bytes are sent.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%{<var>VARNAME</var>}C</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>The contents of cookie <var>VARNAME</var> in the request sent
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal to the server. Only version 0 cookies are fully supported.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%D</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>The time taken to serve the request, in microseconds.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%{<var>VARNAME</var>}e</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>The contents of the environment variable
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <var>VARNAME</var>.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%f</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>Filename.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%h</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>Remote hostname. Will log the IP address if <directive
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal module="core">HostnameLookups</directive> is set to
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <code>Off</code>, which is the default.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%H</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>The request protocol.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%{<var>VARNAME</var>}i</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>The contents of <code><var>VARNAME</var>:</code> header line(s)
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal in the request sent to the server. Changes made by other
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal modules (e.g. <module>mod_headers</module>) affect this.
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal </td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <tr><td><code>%k</code></td>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <td>Number of keepalive requests handled on this connection. Interesting if
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <directive module="core">KeepAlive</directive> is being used, so that,
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye for example, a '1' means the first keepalive request after the initial
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye one, '2' the second, etc...;
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye otherwise this is always 0 (indicating the initial request).</td></tr>
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <tr><td><code>%l</code></td>
0e41d6423b8ed191b1c438091dca3da7d71b6569Trond Norbye <td>Remote logname (from identd, if supplied). This will return a
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye dash unless <module>mod_ident</module> is present and <directive
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye module="mod_ident">IdentityCheck</directive> is set
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <code>On</code>.</td></tr>
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <tr><td><code>%L</code></td>
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye <td>The request log ID from the error log (or '-' if nothing has been
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye logged to the error log for this request). Look for the
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye matching error log line to see what request caused what error.</td></tr>
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <tr><td><code>%m</code></td>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <td>The request method.</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>%{<var>VARNAME</var>}n</code></td>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <td>The contents of note <var>VARNAME</var> from another
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye module.</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>%{<var>VARNAME</var>}o</code></td>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <td>The contents of <code><var>VARNAME</var>:</code> header line(s)
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye in the reply.</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>%p</code></td>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <td>The canonical port of the server serving the request.</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>%{<var>format</var>}p</code></td>
0e41d6423b8ed191b1c438091dca3da7d71b6569Trond Norbye <td>The canonical port of the server serving the request, or the
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye server's actual port, or the client's actual port. Valid formats
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal are <code>canonical</code>, <code>local</code>, or <code>remote</code>.
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal </td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal <tr><td><code>%P</code></td>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <td>The process ID of the child that serviced the request.</td></tr>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
b35e8d4188467587834c9713725171aa0e6ce2deJorgen Austvik <tr><td><code>%{<var>format</var>}P</code></td>
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal <td>The process ID or thread ID of the child that serviced the
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal request. Valid formats are <code>pid</code>, <code>tid</code>,
b35e8d4188467587834c9713725171aa0e6ce2deJorgen Austvik and <code>hextid</code>. <code>hextid</code> requires APR 1.2.0 or
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye higher.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </td></tr>
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal <tr><td><code>%q</code></td>
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal <td>The query string (prepended with a <code>?</code> if a query
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal string exists, otherwise an empty string).</td></tr>
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal <tr><td><code>%r</code></td>
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal <td>First line of request.</td></tr>
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST
a638f353bad3ee605c93aa9808d707dd8198bf8aKnut Anders Hatlen <tr><td><code>%R</code></td>
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal <td>The handler generating the response (if any).</td></tr>
a638f353bad3ee605c93aa9808d707dd8198bf8aKnut Anders Hatlen
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <tr><td><code>%s</code></td>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <td>Status. For requests that have been internally redirected, this is
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye the status of the <em>original</em> request. Use <code>%&gt;s</code>
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal for the final status.</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>%t</code></td>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <td>Time the request was received, in the format <code>[18/Sep/2011:19:18:28 -0400]</code>.
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye The last number indicates the timezone offset from GMT</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
2aef10a5d2ebeaeb6b9cb6fed41933d19a76292fTrond Norbye <tr><td><code>%{<var>format</var>}t</code></td>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <td>The time, in the form given by format, which should be in
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye an extended <code>strftime(3)</code> format (potentially localized).
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye If the format starts with <code>begin:</code> (default) the time is taken
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye at the beginning of the request processing. If it starts with
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <code>end:</code> it is the time when the log entry gets written,
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST close to the end of the request processing. In addition to the formats
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye supported by <code>strftime(3)</code>, the following format tokens are
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye supported:
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <table>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>sec</code></td><td>number of seconds since the Epoch</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>msec</code></td><td>number of milliseconds since the Epoch</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>usec</code></td><td>number of microseconds since the Epoch</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>msec_frac</code></td><td>millisecond fraction</td></tr>
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal <tr><td><code>usec_frac</code></td><td>microsecond fraction</td></tr>
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal </table>
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal These tokens can not be combined with each other or <code>strftime(3)</code>
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal formatting in the same format string. You can use multiple
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <code>%{<var>format</var>}t</code> tokens instead.
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal </td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%T</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>The time taken to serve the request, in seconds.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%u</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>Remote user if the request was authenticated. May be bogus if return status
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal (<code>%s</code>) is 401 (unauthorized).</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%U</code></td>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <td>The URL path requested, not including any query string.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>%v</code></td>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <td>The canonical <directive module="core">ServerName</directive>
0e41d6423b8ed191b1c438091dca3da7d71b6569Trond Norbye of the server serving the request.</td></tr>
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal <tr><td><code>%V</code></td>
685697e8aa716bef7a12e351b4fc3a93b3025f09Vladimir Kotal <td>The server name according to the <directive module="core"
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal >UseCanonicalName</directive> setting.</td></tr>
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal
a04de4b09ef6a455ea16df94e6db7a73240e6bb6Vladimir Kotal <tr><td><code>%X</code></td>
0e41d6423b8ed191b1c438091dca3da7d71b6569Trond Norbye <td>Connection status when response is completed:
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <table>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <columnspec><column width=".2"/><column width=".6"/></columnspec>
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <tr><td><code>X</code> =</td>
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST <td>Connection aborted before the response completed.</td></tr>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <tr><td><code>+</code> =</td>
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <td>Connection may be kept alive after the response is
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye sent.</td></tr>
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye <tr><td><code>-</code> = </td>
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST <td>Connection will be closed after the response is
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye sent.</td></tr>
1b140988201ab90ef3f2e0d9a05ae044b34def2bTrond Norbye </table>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </td></tr>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
0e41d6423b8ed191b1c438091dca3da7d71b6569Trond Norbye <tr><td><code>%I</code></td>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <td>Bytes received, including request and headers. Cannot be zero.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye You need to enable <module>mod_logio</module> to use this.</td></tr>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <tr><td><code>%O</code></td>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <td>Bytes sent, including headers. Cannot be zero. You need to
0e41d6423b8ed191b1c438091dca3da7d71b6569Trond Norbye enable <module>mod_logio</module> to use this.</td></tr>
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen </table>
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen <section id="modifiers"><title>Modifiers</title>
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal <p>Particular items can be restricted to print only for
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal responses with specific HTTP status codes by placing a
74863c57395ccb10e3844c013df6b42c49bcf874Vladimir Kotal comma-separated list of status codes immediately following the
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen "%". The status code list may be peceded by a "<code>!</code>" to
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen indicate negation.</p>
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen <table border="1" style="zebra">
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen <columnspec><column width=".2"/><column width=".8"/></columnspec>
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen <tr><th>Format String</th>
3b4581477b54ccb592cd154399ee30851ae74bb8Knut Anders Hatlen <th>Meaning</th></tr>
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST
a638f353bad3ee605c93aa9808d707dd8198bf8aKnut Anders Hatlen <tr>
a638f353bad3ee605c93aa9808d707dd8198bf8aKnut Anders Hatlen <td><code>%400,501{User-agent}i</code></td>
0e41d6423b8ed191b1c438091dca3da7d71b6569Trond Norbye <td>Logs <code>User-agent</code> on 400 errors and 501 errors only. For
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye other status codes, the literal string <code>"-"</code> will be
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye logged.</td></tr>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <tr><td><code>%!200,304,302{Referer}i</code></td>
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye <td>Logs <code>Referer</code> on all requests that do
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <em>not</em> return one of the three specified codes,
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye "<code>-</code>" otherwise.
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye </td></tr>
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye </table>
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye <p>The modifiers "&lt;" and "&gt;" can be used for requests that
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye have been internally redirected to choose whether the original
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye or final (respectively) request should be consulted. By
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye default, the <code>%</code> directives <code>%s, %U, %T,
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye %D,</code> and <code>%r</code> look at the original request
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye while all others look at the final request. So for example,
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <code>%&gt;s</code> can be used to record the final status of
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye the request and <code>%&lt;u</code> can be used to record the
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye original authenticated user on a request that is internally
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye redirected to an unauthenticated resource.</p>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye </section>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <section id="format-notes"><title>Format Notes</title>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <p>For security reasons, starting with version 2.0.46,
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye non-printable and other special characters in <code>%r</code>,
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <code>%i</code> and <code>%o</code> are escaped using
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <code>\x<var>hh</var></code> sequences, where <var>hh</var>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye stands for the hexadecimal representation of the raw
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye byte. Exceptions from this rule are <code>"</code> and
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <code>\</code>, which are escaped by prepending a backslash, and
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye all whitespace characters, which are written in their C-style
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye notation (<code>\n</code>, <code>\t</code>, etc). In versions
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye prior to 2.0.46, no escaping was performed on these strings so
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye you had to be quite careful when dealing with raw log files.</p>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <p>In httpd 2.0, unlike 1.3, the <code>%b</code> and
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye <code>%B</code> format strings do not represent the number of
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye bytes sent to the client, but simply the size in bytes of the
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye HTTP response (which will differ, for instance, if the
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye connection is aborted, or if SSL is used). The <code>%O</code>
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye format provided by <module>mod_logio</module> will log the
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye actual number of bytes sent over the network.</p>
85b9b88f3a239f3d0014bc5a2b699c1eeb50a47fTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <note>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <p>Note: <module>mod_cache</module> is implemented as a
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye quick-handler and not as a standard handler. Therefore, the
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <code>%R</code> format string will not return any handler
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye information when content caching is involved.</p>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye </note>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye </section>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye <section id="examples"><title>Examples</title>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <p>Some commonly used log format strings are:</p>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye <dl>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <dt>Common Log Format (CLF)</dt>
91bdeb6c93fee2ac50a6ba73fcc63b96effc3340Trond Norbye <dd><code>"%h %l %u %t \"%r\" %&gt;s %b"</code></dd>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye <dt>Common Log Format with Virtual Host</dt>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye <dd><code>"%v %h %l %u %t \"%r\" %&gt;s %b"</code></dd>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <dt>NCSA extended/combined log format</dt>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <dd><code>"%h %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\"
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye \"%{User-agent}i\""</code></dd>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <dt>Referer log format</dt>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <dd><code>"%{Referer}i -&gt; %U"</code></dd>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <dt>Agent (Browser) log format</dt>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <dd><code>"%{User-agent}i"</code></dd>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye </dl>
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <p>You can use the <code>%{format}t</code> directive multiple
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye times to build up a time format using the extended format tokens
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye like <code>msec_frac</code>:</p>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye <dl>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye<dt>Timestamp including milliseconds</dt>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye<dd><code>"%{%d/%b/%Y %T}t.%{msec_frac}t %{%z}t"</code></dd>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </dl>
09d5b31fe4f162365b71c22bad146374c6a7ca0bKnut Anders Hatlen
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye </section>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye</section>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye<section id="security"><title>Security Considerations</title>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <p>See the <a
2aef10a5d2ebeaeb6b9cb6fed41933d19a76292fTrond Norbye href="/misc/security_tips.html#serverroot">security tips</a>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye document for details on why your security could be compromised
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye if the directory where logfiles are stored is writable by
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye anyone other than the user that starts the server.</p>
e6136611a7a3b7d87fc68cdbbcdf42c69a7fb50dTrond Norbye</section>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye<directivesynopsis>
d878aee8c1ee3ea5e330dd7bfebfe07c9dd19089Trond Norbye<name>BufferedLogs</name>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<description>Buffer log entries in memory before writing to disk</description>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<syntax>BufferedLogs On|Off</syntax>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<default>BufferedLogs Off</default>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<contextlist><context>server config</context></contextlist>
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok<compatibility>Available in versions 2.0.41 and later.</compatibility>
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok<usage>
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok <p>The <directive>BufferedLogs</directive> directive causes
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok <module>mod_log_config</module> to store several log entries in
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST memory and write them together to disk, rather than writing them
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok after each request. On some systems, this may result in more
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok efficient disk access and hence higher performance. It may be
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok set only once for the entire server; it cannot be configured
6336b638e9afd018de5f6c516eac4775d140fdaeJHKST per virtual-host.</p>
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok <note>This directive should be used with caution as a crash might
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok cause loss of logging data.</note>
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok</usage>
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok</directivesynopsis>
a041b2b7edcc83a8c8b64689fbdb85321300431ejel+opengrok
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<directivesynopsis>
<name>CustomLog</name>
<description>Sets filename and format of log file</description>
<syntax>CustomLog <var>file</var>|<var>pipe</var>
<var>format</var>|<var>nickname</var>
[env=[!]<var>environment-variable</var>]</syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
<usage>
<p>The <directive>CustomLog</directive> directive is used to
log requests to the server. A log format is specified, and the
logging can optionally be made conditional on request
characteristics using environment variables.</p>
<p>The first argument, which specifies the location to which
the logs will be written, can take one of the following two
types of values:</p>
<dl>
<dt><var>file</var></dt>
<dd>A filename, relative to the <directive module="core"
>ServerRoot</directive>.</dd>
<dt><var>pipe</var></dt>
<dd>The pipe character "<code>|</code>", followed by the path
to a program to receive the log information on its standard
input. See the notes on <a href="/logs.html#piped">piped logs</a>
for more information.
<note type="warning"><title>Security:</title>
<p>If a program is used, then it will be run as the user who
started <program>httpd</program>. This will be root if the server was
started by root; be sure that the program is secure.</p>
</note>
<note type="warning"><title>Note</title>
<p>When entering a file path on non-Unix platforms, care should be taken
to make sure that only forward slashed are used even though the platform
may allow the use of back slashes. In general it is a good idea to always
use forward slashes throughout the configuration files.</p>
</note></dd>
</dl>
<p>The second argument specifies what will be written to the
log file. It can specify either a <var>nickname</var> defined by
a previous <directive module="mod_log_config">LogFormat</directive>
directive, or it can be an explicit <var>format</var> string as
described in the <a href="#formats">log formats</a> section.</p>
<p>For example, the following two sets of directives have
exactly the same effect:</p>
<example>
# CustomLog with format nickname<br />
LogFormat "%h %l %u %t \"%r\" %&gt;s %b" common<br />
CustomLog logs/access_log common<br />
<br />
# CustomLog with explicit format string<br />
CustomLog logs/access_log "%h %l %u %t \"%r\" %&gt;s %b"
</example>
<p>The third argument is optional and controls whether or
not to log a particular request based on the
presence or absence of a particular variable in the server
environment. If the specified <a href="/env.html">environment
variable</a> is set for the request (or is not set, in the case
of a '<code>env=!<var>name</var></code>' clause), then the
request will be logged.</p>
<p>Environment variables can be set on a per-request
basis using the <module>mod_setenvif</module>
and/or <module>mod_rewrite</module> modules. For
example, if you want to record requests for all GIF
images on your server in a separate logfile but not in your main
log, you can use:</p>
<example>
SetEnvIf Request_URI \.gif$ gif-image<br />
CustomLog gif-requests.log common env=gif-image<br />
CustomLog nongif-requests.log common env=!gif-image
</example>
<p>Or, to reproduce the behavior of the old RefererIgnore
directive, you might use the following:</p>
<example>
SetEnvIf Referer example\.com localreferer<br />
CustomLog referer.log referer env=!localreferer
</example>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>LogFormat</name>
<description>Describes a format for use in a log file</description>
<syntax>LogFormat <var>format</var>|<var>nickname</var>
[<var>nickname</var>]</syntax>
<default>LogFormat "%h %l %u %t \"%r\" %>s %b"</default>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
<usage>
<p>This directive specifies the format of the access log
file.</p>
<p>The <directive>LogFormat</directive> directive can take one of two
forms. In the first form, where only one argument is specified,
this directive sets the log format which will be used by logs
specified in subsequent <directive>TransferLog</directive>
directives. The single argument can specify an explicit
<var>format</var> as discussed in the <a href="#formats">custom log
formats</a> section above. Alternatively, it can use a
<var>nickname</var> to refer to a log format defined in a
previous <directive>LogFormat</directive> directive as described
below.</p>
<p>The second form of the <directive>LogFormat</directive>
directive associates an explicit <var>format</var> with a
<var>nickname</var>. This <var>nickname</var> can then be used in
subsequent <directive>LogFormat</directive> or
<directive module="mod_log_config">CustomLog</directive> directives
rather than repeating the entire format string. A
<directive>LogFormat</directive> directive that defines a nickname
<strong>does nothing else</strong> -- that is, it <em>only</em>
defines the nickname, it doesn't actually apply the format and make
it the default. Therefore, it will not affect subsequent
<directive module="mod_log_config">TransferLog</directive> directives.
In addition, <directive>LogFormat</directive> cannot use one nickname
to define another nickname. Note that the nickname should not contain
percent signs (<code>%</code>).</p>
<example><title>Example</title>
LogFormat "%v %h %l %u %t \"%r\" %&gt;s %b" vhost_common
</example>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>TransferLog</name>
<description>Specify location of a log file</description>
<syntax>TransferLog <var>file</var>|<var>pipe</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
<usage>
<p>This directive has exactly the same arguments and effect as
the <directive module="mod_log_config">CustomLog</directive>
directive, with the exception that it does not allow the log format
to be specified explicitly or for conditional logging of requests.
Instead, the log format is determined by the most recently specified
<directive module="mod_log_config">LogFormat</directive> directive
which does not define a nickname. Common Log Format is used if no
other format has been specified.</p>
<example><title>Example</title>
LogFormat "%h %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\" \"%{User-agent}i\""<br />
TransferLog logs/access_log
</example>
</usage>
</directivesynopsis>
</modulesynopsis>