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