mod_log_config.html.en revision a2216d72fefddc2d3a51b9bcb92ad17b2a02f77f
842ae4bd224140319ae7feec1872b93dfd491143fielding<?xml version="1.0" encoding="ISO-8859-1"?>
842ae4bd224140319ae7feec1872b93dfd491143fielding<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
842ae4bd224140319ae7feec1872b93dfd491143fielding<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
842ae4bd224140319ae7feec1872b93dfd491143fielding XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
842ae4bd224140319ae7feec1872b93dfd491143fielding This file is generated from xml source: DO NOT EDIT
842ae4bd224140319ae7feec1872b93dfd491143fielding XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2d2eda71267231c2526be701fe655db125852c1ffielding -->
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<title>mod_log_config - Apache HTTP Server</title>
2d2eda71267231c2526be701fe655db125852c1ffielding<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<link href="/images/favicon.ico" rel="shortcut icon" /></head>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<body>
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd<div id="page-header">
2d2eda71267231c2526be701fe655db125852c1ffielding<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>
2d2eda71267231c2526be701fe655db125852c1ffielding<p class="apache">Apache HTTP Server Version 2.3</p>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<img alt="" src="/images/feather.gif" /></div>
0432a26b69eedfb9ca5f34fba590236378a24851ben<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
0432a26b69eedfb9ca5f34fba590236378a24851ben<div id="path">
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<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.3</a> &gt; <a href="./">Modules</a></div>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<div id="page-content">
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<div id="preamble"><h1>Apache Module mod_log_config</h1>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<div class="toplang">
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<p><span>Available Languages: </span><a href="/en/mod/mod_log_config.html" title="English">&nbsp;en&nbsp;</a> |
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<a href="/ja/mod/mod_log_config.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<a href="/ko/mod/mod_log_config.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<a href="/tr/mod/mod_log_config.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh</div>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<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>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>log_config_module</td></tr>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_log_config.c</td></tr></table>
2d2eda71267231c2526be701fe655db125852c1ffielding<h3>Summary</h3>
2d2eda71267231c2526be701fe655db125852c1ffielding
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <p>This module provides for flexible logging of client
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh requests. Logs are written in a customizable format, and may be
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh written directly to a file, or to an external program.
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb Conditional logging is provided so that individual requests may
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb be included or excluded from the logs based on characteristics
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb of the request.</p>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
2d2eda71267231c2526be701fe655db125852c1ffielding <p>Three directives are provided by this module:
30c289e6bc6d28d210b21edd800ab2cfc78a8381wrowe <code class="directive"><a href="#transferlog">TransferLog</a></code> to create
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein a log file, <code class="directive"><a href="#logformat">LogFormat</a></code>
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein to set a custom format, and <code class="directive"><a href="#customlog">CustomLog</a></code> to define a log file and format in one
cd39d2139743ca0ef899953c6496dcf99e9c791atrawick step. The <code class="directive">TransferLog</code> and <code class="directive">CustomLog</code> directives can be used multiple times in each
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein server to cause each request to be logged to multiple files.</p>
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton</div>
b627048681b27fe30f979ba471b523be3a6a22adrbb<div id="quickview"><h3 class="directives">Directives</h3>
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein<ul id="toc">
cccd31fa4a72fe23cc3249c06db181b274a55a69gstein<li><img alt="" src="/images/down.gif" /> <a href="#bufferedlogs">BufferedLogs</a></li>
44c46ef733836b32585d135d2d90856e7cfd9929rbb<li><img alt="" src="/images/down.gif" /> <a href="#cookielog">CookieLog</a></li>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<li><img alt="" src="/images/down.gif" /> <a href="#customlog">CustomLog</a></li>
e6cc28a5eb3371ba0c38e941855e71ff0054f50erbb<li><img alt="" src="/images/down.gif" /> <a href="#logformat">LogFormat</a></li>
d9039a9aaeaa1359c1147af66c09aeac56ae3ee0pquerna<li><img alt="" src="/images/down.gif" /> <a href="#transferlog">TransferLog</a></li>
cdccf2ac94172d1a4a54bc2e17324e1ef682ccf3pquerna</ul>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<h3>Topics</h3>
9cfc48b742c224c1fbc2c26a4119a3266192c7d2wrowe<ul id="topics">
9cfc48b742c224c1fbc2c26a4119a3266192c7d2wrowe<li><img alt="" src="/images/down.gif" /> <a href="#formats">Custom Log Formats</a></li>
ef5650b61a8e35f3cc93ec07e73efc17ea329894jorton<li><img alt="" src="/images/down.gif" /> <a href="#security">Security Considerations</a></li>
7c7372abe2484e7fcf81937b93496d1246e5b816gstein</ul><h3>See also</h3>
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton<ul class="seealso">
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton<li><a href="/logs.html">Apache Log Files</a></li>
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton</ul></div>
a261b81a1044c0e2ea3f21cf9b7019297bad16aajorton<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
d71fd7cd9c4815d0647425f21ba3a803919a9148jorton<div class="section">
7c7372abe2484e7fcf81937b93496d1246e5b816gstein<h2><a name="formats" id="formats">Custom Log Formats</a></h2>
7c7372abe2484e7fcf81937b93496d1246e5b816gstein
7c7372abe2484e7fcf81937b93496d1246e5b816gstein <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
7c7372abe2484e7fcf81937b93496d1246e5b816gstein used to log each request to the log file. It can contain literal
7c7372abe2484e7fcf81937b93496d1246e5b816gstein characters copied into the log files and the C-style control
2d2eda71267231c2526be701fe655db125852c1ffielding characters "\n" and "\t" to represent new-lines and tabs.
2d2eda71267231c2526be701fe655db125852c1ffielding Literal quotes and backslashes should be escaped with
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh backslashes.</p>
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding <p>The characteristics of the request itself are logged by
2d2eda71267231c2526be701fe655db125852c1ffielding placing "<code>%</code>" directives in the format string, which are
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh replaced in the log file by the values as follows:</p>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh <table class="bordered"><tr class="header"><th>Format&nbsp;String</th>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh <th>Description</th></tr>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr><td><code>%%</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>The percent sign.</td></tr>
dd5cbadf2df719db2f3c769d03ec847da25854e6bnicholes<tr class="odd"><td><code>%a</code></td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>Remote IP-address.</td></tr>
dd5cbadf2df719db2f3c769d03ec847da25854e6bnicholes<tr><td><code>%A</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Local IP-address.</td></tr>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr class="odd"><td><code>%B</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Size of response in bytes, excluding HTTP headers.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><td><code>%b</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Size of response in bytes, excluding HTTP headers. In CLF format, <em>i.e.</em>
2d2eda71267231c2526be701fe655db125852c1ffielding a '<code>-</code>' rather than a 0 when no bytes are sent.</td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<tr class="odd"><td><code>%{<var>VARNAME</var>}C</code></td>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <td>The contents of cookie <var>VARNAME</var> in the request sent
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb to the server. Only version 0 cookies are fully supported.</td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<tr><td><code>%D</code></td>
72a4ef8eac1adef882246c5bfb9b8bbd82d613c4coar <td>The time taken to serve the request, in microseconds.</td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<tr class="odd"><td><code>%{<var>VARNAME</var>}e</code></td>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <td>The contents of the environment variable
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <var>VARNAME</var>.</td></tr>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr><td><code>%f</code></td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>Filename.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%h</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Remote host.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><td><code>%H</code></td>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh <td>The request protocol.</td></tr>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh<tr class="odd"><td><code>%{<var>VARNAME</var>}i</code></td>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh <td>The contents of <code><var>VARNAME</var>:</code> header line(s)
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh in the request sent to the server. Changes made by other
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh modules (e.g. <code class="module"><a href="/mod/mod_headers.html">mod_headers</a></code>) affect this.
2d2eda71267231c2526be701fe655db125852c1ffielding </td></tr>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh<tr><td><code>%k</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Number of keepalive requests handled on this connection. Interesting if
2d2eda71267231c2526be701fe655db125852c1ffielding <code class="directive"><a href="/mod/core.html#keepalive">KeepAlive</a></code> is being used, so that,
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh for example, a '1' means the first keepalive request after the initial
2d2eda71267231c2526be701fe655db125852c1ffielding one, '2' the second, etc...;
a0bd5cdd79004f4b7b1b441e38133519d3e20a1fsf otherwise this is always 0 (indicating the initial request).</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%l</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Remote logname (from identd, if supplied). This will return a
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh 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
2d2eda71267231c2526be701fe655db125852c1ffielding <code>On</code>.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><td><code>%L</code></td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>The request log ID from the error log (or '-' if nothing has been
2d2eda71267231c2526be701fe655db125852c1ffielding logged to the error log for this request). Look for the
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh matching error log line to see what request caused what error.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%m</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>The request method.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><td><code>%{<var>VARNAME</var>}n</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>The contents of note <var>VARNAME</var> from another
2d2eda71267231c2526be701fe655db125852c1ffielding module.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%{<var>VARNAME</var>}o</code></td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>The contents of <code><var>VARNAME</var>:</code> header line(s)
2d2eda71267231c2526be701fe655db125852c1ffielding in the reply.</td></tr>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh<tr><td><code>%p</code></td>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh <td>The canonical port of the server serving the request.</td></tr>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh<tr class="odd"><td><code>%{<var>format</var>}p</code></td>
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh <td>The canonical port of the server serving the request, or the
2d2eda71267231c2526be701fe655db125852c1ffielding server's actual port, or the client's actual port. Valid formats
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh are <code>canonical</code>, <code>local</code>, or <code>remote</code>.
2d2eda71267231c2526be701fe655db125852c1ffielding </td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><td><code>%P</code></td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>The process ID of the child that serviced the request.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%{<var>format</var>}P</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>The process ID or thread ID of the child that serviced the
2d2eda71267231c2526be701fe655db125852c1ffielding request. Valid formats are <code>pid</code>, <code>tid</code>,
2d2eda71267231c2526be701fe655db125852c1ffielding and <code>hextid</code>. <code>hextid</code> requires APR 1.2.0 or
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh higher.
2d2eda71267231c2526be701fe655db125852c1ffielding </td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><td><code>%q</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>The query string (prepended with a <code>?</code> if a query
2d2eda71267231c2526be701fe655db125852c1ffielding string exists, otherwise an empty string).</td></tr>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr class="odd"><td><code>%r</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>First line of request.</td></tr>
dbbf1b4183ae16353011a5269b37899f02b97d81gregames<tr><td><code>%R</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>The handler generating the response (if any).</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%s</code></td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>Status. For requests that have been internally redirected, this is
2d2eda71267231c2526be701fe655db125852c1ffielding the status of the <em>original</em> request. Use <code>%&gt;s</code>
e44e11f9fece12c783f18d033923bfc0d6b4289aake for the final status.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><td><code>%t</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Time the request was received, in the format <code>[18/Sep/2011:19:18:28 -0400]</code>.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh The last number indicates the timezone offset from GMT</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%{<var>format</var>}t</code></td>
ee1af2aeb57527f33baa4737aa431e4aef997855rbowen <td>The time, in the form given by format, which should be in
2d2eda71267231c2526be701fe655db125852c1ffielding an extended <code>strftime(3)</code> format (potentially localized).
2d2eda71267231c2526be701fe655db125852c1ffielding If the format starts with <code>begin:</code> (default) the time is taken
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh at the beginning of the request processing. If it starts with
2d2eda71267231c2526be701fe655db125852c1ffielding <code>end:</code> it is the time when the log entry gets written,
2d2eda71267231c2526be701fe655db125852c1ffielding close to the end of the request processing. In addition to the formats
2d2eda71267231c2526be701fe655db125852c1ffielding supported by <code>strftime(3)</code>, the following format tokens are
2d2eda71267231c2526be701fe655db125852c1ffielding supported:
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <table>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <tr><td><code>sec</code></td><td>number of seconds since the Epoch</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding <tr><td><code>msec</code></td><td>number of milliseconds since the Epoch</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding <tr><td><code>usec</code></td><td>number of microseconds since the Epoch</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding <tr><td><code>msec_frac</code></td><td>millisecond fraction</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding <tr><td><code>usec_frac</code></td><td>microsecond fraction</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding </table>
2d2eda71267231c2526be701fe655db125852c1ffielding These tokens can not be combined with each other or <code>strftime(3)</code>
2d2eda71267231c2526be701fe655db125852c1ffielding formatting in the same format string. You can use multiple
2d2eda71267231c2526be701fe655db125852c1ffielding <code>%{<var>format</var>}t</code> tokens instead.
2d2eda71267231c2526be701fe655db125852c1ffielding </td></tr>
ee7882748b83255e50ea6bc3b3fdc8ee0949e2e3jorton<tr><td><code>%T</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>The time taken to serve the request, in seconds.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%u</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Remote user if the request was authenticated. May be bogus if return status
2d2eda71267231c2526be701fe655db125852c1ffielding (<code>%s</code>) is 401 (unauthorized).</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><td><code>%U</code></td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>The URL path requested, not including any query string.</td></tr>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr class="odd"><td><code>%v</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>The canonical <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code>
2d2eda71267231c2526be701fe655db125852c1ffielding of the server serving the request.</td></tr>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh<tr><td><code>%V</code></td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>The server name according to the <code class="directive"><a href="/mod/core.html#usecanonicalname">UseCanonicalName</a></code> setting.</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr class="odd"><td><code>%X</code></td>
2d2eda71267231c2526be701fe655db125852c1ffielding <td>Connection status when response is completed:
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <table>
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding <tr><td><code>X</code> =</td>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <td>Connection aborted before the response completed.</td></tr>
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet <tr><td><code>+</code> =</td>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh <td>Connection may be kept alive after the response is
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet sent.</td></tr>
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet <tr><td><code>-</code> = </td>
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet <td>Connection will be closed after the response is
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet sent.</td></tr>
2efb935ae8fe12d5192a3bf2c52c28461b6c68afdgaudet </table>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb </td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<tr><td><code>%I</code></td>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <td>Bytes received, including request and headers. Cannot be zero.
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb You need to enable <code class="module"><a href="/mod/mod_logio.html">mod_logio</a></code> to use this.</td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<tr class="odd"><td><code>%O</code></td>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh <td>Bytes sent, including headers. Cannot be zero. You need to
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb enable <code class="module"><a href="/mod/mod_logio.html">mod_logio</a></code> to use this.</td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb</table>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <h3><a name="modifiers" id="modifiers">Modifiers</a></h3>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <p>Particular items can be restricted to print only for
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb responses with specific HTTP status codes by placing a
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb comma-separated list of status codes immediately following the
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb "%". For example, <code>"%400,501{User-agent}i"</code> logs
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <code>User-agent</code> on 400 errors and 501 errors only. For
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb other status codes, the literal string <code>"-"</code> will be
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb logged. The status code list may be preceded by a
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh "<code>!</code>" to indicate negation:
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <code>"%!200,304,302{Referer}i"</code> logs <code>Referer</code>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb on all requests that do <em>not</em> return one of the three
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh specified codes.</p>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <p>The modifiers "&lt;" and "&gt;" can be used for requests that
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh have been internally redirected to choose whether the original
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb or final (respectively) request should be consulted. By
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb default, the <code>%</code> directives <code>%s, %U, %T,
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb %D,</code> and <code>%r</code> look at the original request
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh while all others look at the final request. So for example,
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <code>%&gt;s</code> can be used to record the final status of
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb the request and <code>%&lt;u</code> can be used to record the
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb original authenticated user on a request that is internally
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh redirected to an unauthenticated resource.</p>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
99d6d3207e24ba1f8eba77ef903948d738886cf5nd <h3><a name="format-notes" id="format-notes">Some Notes</a></h3>
99d6d3207e24ba1f8eba77ef903948d738886cf5nd
99d6d3207e24ba1f8eba77ef903948d738886cf5nd <p>For security reasons, starting with version 2.0.46,
99d6d3207e24ba1f8eba77ef903948d738886cf5nd non-printable and other special characters in <code>%r</code>,
99d6d3207e24ba1f8eba77ef903948d738886cf5nd <code>%i</code> and <code>%o</code> are escaped using
99d6d3207e24ba1f8eba77ef903948d738886cf5nd <code>\x<var>hh</var></code> sequences, where <var>hh</var>
99d6d3207e24ba1f8eba77ef903948d738886cf5nd stands for the hexadecimal representation of the raw
99d6d3207e24ba1f8eba77ef903948d738886cf5nd byte. Exceptions from this rule are <code>"</code> and
99d6d3207e24ba1f8eba77ef903948d738886cf5nd <code>\</code>, which are escaped by prepending a backslash, and
99d6d3207e24ba1f8eba77ef903948d738886cf5nd all whitespace characters, which are written in their C-style
99d6d3207e24ba1f8eba77ef903948d738886cf5nd notation (<code>\n</code>, <code>\t</code>, etc). In versions
99d6d3207e24ba1f8eba77ef903948d738886cf5nd prior to 2.0.46, no escaping was performed on these strings so
99d6d3207e24ba1f8eba77ef903948d738886cf5nd you had to be quite careful when dealing with raw log files.</p>
99d6d3207e24ba1f8eba77ef903948d738886cf5nd
99d6d3207e24ba1f8eba77ef903948d738886cf5nd <p>In httpd 2.0, unlike 1.3, the <code>%b</code> and
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <code>%B</code> format strings do not represent the number of
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh bytes sent to the client, but simply the size in bytes of the
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb HTTP response (which will differ, for instance, if the
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh connection is aborted, or if SSL is used). The <code>%O</code>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb format provided by <code class="module"><a href="/mod/mod_logio.html">mod_logio</a></code> will log the
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh actual number of bytes sent over the network.</p>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <p>Note: <code class="module"><a href="/mod/mod_cache.html">mod_cache</a></code> is implemented as a
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb quick-handler and not as a standard handler. Therefore, the
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <code>%R</code> format string will not return any handler
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh information when content caching is involved.</p>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <h3><a name="examples" id="examples">Examples</a></h3>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <p>Some commonly used log format strings are:</p>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <dl>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <dt>Common Log Format (CLF)</dt>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <dd><code>"%h %l %u %t \"%r\" %&gt;s %b"</code></dd>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <dt>Common Log Format with Virtual Host</dt>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <dd><code>"%v %h %l %u %t \"%r\" %&gt;s %b"</code></dd>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <dt>NCSA extended/combined log format</dt>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <dd><code>"%h %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\"
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben \"%{User-agent}i\""</code></dd>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <dt>Referer log format</dt>
7b6ba9c468f26bdb3492d5e8cb79628a3b04e8c8wrowe <dd><code>"%{Referer}i -&gt; %U"</code></dd>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <dt>Agent (Browser) log format</dt>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <dd><code>"%{User-agent}i"</code></dd>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh </dl>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb <p>You can use the <code>%{format}t</code> directive multiple
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb times to build up a time format using the extended format tokens
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh like <code>msec_frac</code>:</p>
1374444b4fab1475091e12a81663f379b73005efrbb <dl>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<dt>Timestamp including milliseconds</dt>
bbe046d7cbb950ab3e372e4119ae001a5fe52ed4striker<dd><code>"%{%d/%b/%Y %T}t.%{msec_frac}t %{%z}t"</code></dd>
bbe046d7cbb950ab3e372e4119ae001a5fe52ed4striker
bbe046d7cbb950ab3e372e4119ae001a5fe52ed4striker </dl>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
c8aa00ee0cfc17b5fa08fb8a2b08d30dc9e4f1b1wrowe</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
c8aa00ee0cfc17b5fa08fb8a2b08d30dc9e4f1b1wrowe<div class="section">
4542d057c4bde23857f31d449fa3108561206139wrowe<h2><a name="security" id="security">Security Considerations</a></h2>
c8aa00ee0cfc17b5fa08fb8a2b08d30dc9e4f1b1wrowe <p>See the <a href="/misc/security_tips.html#serverroot">security tips</a>
4542d057c4bde23857f31d449fa3108561206139wrowe document for details on why your security could be compromised
c8aa00ee0cfc17b5fa08fb8a2b08d30dc9e4f1b1wrowe if the directory where logfiles are stored is writable by
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh anyone other than the user that starts the server.</p>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb</div>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh<div class="directive-section"><h2><a name="BufferedLogs" id="BufferedLogs">BufferedLogs</a> <a name="bufferedlogs" id="bufferedlogs">Directive</a></h2>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<table class="directive">
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Buffer log entries in memory before writing to disk</td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BufferedLogs On|Off</code></td></tr>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>BufferedLogs Off</code></td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in versions 2.0.41 and later.</td></tr>
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames</table>
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames <p>The <code class="directive">BufferedLogs</code> directive causes
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames <code class="module"><a href="/mod/mod_log_config.html">mod_log_config</a></code> to store several log entries in
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames memory and write them together to disk, rather than writing them
6d74c65f131583f6832b04424c1a9e1e7cc72c8egregames after each request. On some systems, this may result in more
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh efficient disk access and hence higher performance. It may be
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh set only once for the entire server; it cannot be configured
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh per virtual-host.</p>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh <div class="note">This directive should be used with caution as a crash might
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb cause loss of logging data.</div>
2e123e8beedc9f921448c113e2d6823a92fd5261fielding
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben</div>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<div class="directive-section"><h2><a name="CookieLog" id="CookieLog">CookieLog</a> <a name="cookielog" id="cookielog">Directive</a></h2>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<table class="directive">
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets filename for the logging of cookies</td></tr>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CookieLog <var>filename</var></code></td></tr>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>This directive is deprecated.</td></tr>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben</table>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <p>The <code class="directive">CookieLog</code> directive sets the
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben filename for logging of cookies. The filename is relative to the
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <code class="directive"><a href="/mod/core.html#serverroot">ServerRoot</a></code>. This directive is
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben included only for compatibility with <code>mod_cookies</code>,
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben and is deprecated.</p>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben</div>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe<div class="directive-section"><h2><a name="CustomLog" id="CustomLog">CustomLog</a> <a name="customlog" id="customlog">Directive</a></h2>
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe<table class="directive">
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets filename and format of log file</td></tr>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CustomLog <var>file</var>|<var>pipe</var>
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe<var>format</var>|<var>nickname</var>
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe[env=[!]<var>environment-variable</var>]</code></td></tr>
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
64b9fa4bc3e79b0eefb2d93fb56eae40d88e0f06wrowe</table>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <p>The <code class="directive">CustomLog</code> directive is used to
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben log requests to the server. A log format is specified, and the
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben logging can optionally be made conditional on request
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben characteristics using environment variables.</p>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh <p>The first argument, which specifies the location to which
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh the logs will be written, can take one of the following two
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh types of values:</p>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <dl>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <dt><var>file</var></dt>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <dd>A filename, relative to the <code class="directive"><a href="/mod/core.html#serverroot">ServerRoot</a></code>.</dd>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh <dt><var>pipe</var></dt>
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh <dd>The pipe character "<code>|</code>", followed by the path
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh to a program to receive the log information on its standard
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh input. See the notes on <a href="/logs.html#piped">piped logs</a>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben for more information.
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <div class="warning"><h3>Security:</h3>
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben <p>If a program is used, then it will be run as the user who
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd started <code class="program"><a href="/programs/httpd.html">httpd</a></code>. This will be root if the server was
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh started by root; be sure that the program is secure.</p>
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd </div>
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd <div class="warning"><h3>Note</h3>
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd <p>When entering a file path on non-Unix platforms, care should be taken
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd to make sure that only forward slashed are used even though the platform
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd may allow the use of back slashes. In general it is a good idea to always
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd use forward slashes throughout the configuration files.</p>
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd </div></dd>
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd </dl>
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd <p>The second argument specifies what will be written to the
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd log file. It can specify either a <var>nickname</var> defined by
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd a previous <code class="directive"><a href="#logformat">LogFormat</a></code>
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd directive, or it can be an explicit <var>format</var> string as
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd described in the <a href="#formats">log formats</a> section.</p>
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd <p>For example, the following two sets of directives have
d11bf78168abbb07d8ed9f54d7ea0953d46aad83nd exactly the same effect:</p>
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick <div class="example"><p><code>
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick # CustomLog with format nickname<br />
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick LogFormat "%h %l %u %t \"%r\" %&gt;s %b" common<br />
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick CustomLog logs/access_log common<br />
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb <br />
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick # CustomLog with explicit format string<br />
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb CustomLog logs/access_log "%h %l %u %t \"%r\" %&gt;s %b"
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb </code></p></div>
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick <p>The third argument is optional and controls whether or
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick not to log a particular request based on the
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick presence or absence of a particular variable in the server
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick environment. If the specified <a href="/env.html">environment
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick variable</a> is set for the request (or is not set, in the case
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick of a '<code>env=!<var>name</var></code>' clause), then the
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick request will be logged.</p>
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick
1ce78cf71b5baaf2c1ab48e818cb1f2397df5010trawick <p>Environment variables can be set on a per-request
759f4a24d09e28c4eaca9f97311b497fc15cb5c7ben basis using the <code class="module"><a href="/mod/mod_setenvif.html">mod_setenvif</a></code>
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb and/or <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> modules. For
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb example, if you want to record requests for all GIF
3d96ee83babeec32482c9082c9426340cee8c44dwrowe images on your server in a separate logfile but not in your main
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb log, you can use:</p>
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb <div class="example"><p><code>
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb SetEnvIf Request_URI \.gif$ gif-image<br />
a520b923984f45daeaf0741d5c7e3de1f2d24509rbb CustomLog gif-requests.log common env=gif-image<br />
3d96ee83babeec32482c9082c9426340cee8c44dwrowe CustomLog nongif-requests.log common env=!gif-image
2d2eda71267231c2526be701fe655db125852c1ffielding </code></p></div>
4e2c23ca8bd7b207f6e9c396759c1e2171370990trawick
ceb14f8ba57a8086c9a68ad264efbe2433134382covener <p>Or, to reproduce the behavior of the old RefererIgnore
ceb14f8ba57a8086c9a68ad264efbe2433134382covener directive, you might use the following:</p>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh <div class="example"><p><code>
2d2eda71267231c2526be701fe655db125852c1ffielding SetEnvIf Referer example\.com localreferer<br />
2d2eda71267231c2526be701fe655db125852c1ffielding CustomLog referer.log referer env=!localreferer
b0d8a6d437db6f4c222173f27ef81c98622fbd02pquerna </code></p></div>
b0d8a6d437db6f4c222173f27ef81c98622fbd02pquerna
2d2eda71267231c2526be701fe655db125852c1ffielding</div>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<div class="directive-section"><h2><a name="LogFormat" id="LogFormat">LogFormat</a> <a name="logformat" id="logformat">Directive</a></h2>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<table class="directive">
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Describes a format for use in a log file</td></tr>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogFormat <var>format</var>|<var>nickname</var>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener[<var>nickname</var>]</code></td></tr>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogFormat "%h %l %u %t \"%r\" %&gt;s %b"</code></td></tr>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
ceb14f8ba57a8086c9a68ad264efbe2433134382covener<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding</table>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh <p>This directive specifies the format of the access log
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh file.</p>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh <p>The <code class="directive">LogFormat</code> directive can take one of two
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh forms. In the first form, where only one argument is specified,
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh this directive sets the log format which will be used by logs
2d2eda71267231c2526be701fe655db125852c1ffielding specified in subsequent <code class="directive">TransferLog</code>
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm directives. The single argument can specify an explicit
2d2eda71267231c2526be701fe655db125852c1ffielding <var>format</var> as discussed in the <a href="#formats">custom log
cf35a54aa4b61245bf315cc594f8809c1cf31729geoff formats</a> section above. Alternatively, it can use a
2d2eda71267231c2526be701fe655db125852c1ffielding <var>nickname</var> to refer to a log format defined in a
2d2eda71267231c2526be701fe655db125852c1ffielding previous <code class="directive">LogFormat</code> directive as described
2d2eda71267231c2526be701fe655db125852c1ffielding below.</p>
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding <p>The second form of the <code class="directive">LogFormat</code>
2d2eda71267231c2526be701fe655db125852c1ffielding directive associates an explicit <var>format</var> with a
2d2eda71267231c2526be701fe655db125852c1ffielding <var>nickname</var>. This <var>nickname</var> can then be used in
2d2eda71267231c2526be701fe655db125852c1ffielding subsequent <code class="directive">LogFormat</code> or
2d2eda71267231c2526be701fe655db125852c1ffielding <code class="directive"><a href="#customlog">CustomLog</a></code> directives
2d2eda71267231c2526be701fe655db125852c1ffielding rather than repeating the entire format string. A
2d2eda71267231c2526be701fe655db125852c1ffielding <code class="directive">LogFormat</code> directive that defines a nickname
2d2eda71267231c2526be701fe655db125852c1ffielding <strong>does nothing else</strong> -- that is, it <em>only</em>
2d2eda71267231c2526be701fe655db125852c1ffielding defines the nickname, it doesn't actually apply the format and make
2d2eda71267231c2526be701fe655db125852c1ffielding it the default. Therefore, it will not affect subsequent
2d2eda71267231c2526be701fe655db125852c1ffielding <code class="directive"><a href="#transferlog">TransferLog</a></code> directives.
2d2eda71267231c2526be701fe655db125852c1ffielding In addition, <code class="directive">LogFormat</code> cannot use one nickname
2d2eda71267231c2526be701fe655db125852c1ffielding to define another nickname. Note that the nickname should not contain
2d2eda71267231c2526be701fe655db125852c1ffielding percent signs (<code>%</code>).</p>
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding <div class="example"><h3>Example</h3><p><code>
2d2eda71267231c2526be701fe655db125852c1ffielding LogFormat "%v %h %l %u %t \"%r\" %&gt;s %b" vhost_common
2d2eda71267231c2526be701fe655db125852c1ffielding </code></p></div>
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding</div>
2d2eda71267231c2526be701fe655db125852c1ffielding<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
2d2eda71267231c2526be701fe655db125852c1ffielding<div class="directive-section"><h2><a name="TransferLog" id="TransferLog">TransferLog</a> <a name="transferlog" id="transferlog">Directive</a></h2>
2d2eda71267231c2526be701fe655db125852c1ffielding<table class="directive">
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify location of a log file</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TransferLog <var>file</var>|<var>pipe</var></code></td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
2d2eda71267231c2526be701fe655db125852c1ffielding</table>
2d2eda71267231c2526be701fe655db125852c1ffielding <p>This directive has exactly the same arguments and effect as
2d2eda71267231c2526be701fe655db125852c1ffielding the <code class="directive"><a href="#customlog">CustomLog</a></code>
2d2eda71267231c2526be701fe655db125852c1ffielding directive, with the exception that it does not allow the log format
2d2eda71267231c2526be701fe655db125852c1ffielding to be specified explicitly or for conditional logging of requests.
2d2eda71267231c2526be701fe655db125852c1ffielding Instead, the log format is determined by the most recently specified
2d2eda71267231c2526be701fe655db125852c1ffielding <code class="directive"><a href="#logformat">LogFormat</a></code> directive
2d2eda71267231c2526be701fe655db125852c1ffielding which does not define a nickname. Common Log Format is used if no
4d88cba691cf0cc222161dc403067071eca58751rbb other format has been specified.</p>
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding <div class="example"><h3>Example</h3><p><code>
2d2eda71267231c2526be701fe655db125852c1ffielding LogFormat "%h %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\" \"%{User-agent}i\""<br />
2d2eda71267231c2526be701fe655db125852c1ffielding TransferLog logs/access_log
2d2eda71267231c2526be701fe655db125852c1ffielding </code></p></div>
2d2eda71267231c2526be701fe655db125852c1ffielding
2d2eda71267231c2526be701fe655db125852c1ffielding</div>
2d2eda71267231c2526be701fe655db125852c1ffielding</div>
2d2eda71267231c2526be701fe655db125852c1ffielding<div class="bottomlang">
2d2eda71267231c2526be701fe655db125852c1ffielding<p><span>Available Languages: </span><a href="/en/mod/mod_log_config.html" title="English">&nbsp;en&nbsp;</a> |
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh<a href="/ja/mod/mod_log_config.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
2d2eda71267231c2526be701fe655db125852c1ffielding<a href="/ko/mod/mod_log_config.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh<a href="/tr/mod/mod_log_config.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
2d2eda71267231c2526be701fe655db125852c1ffielding</div><div id="footer">
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh<p class="apache">Copyright 2011 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
2d2eda71267231c2526be701fe655db125852c1ffielding<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></div>
3d0bdf16bc410722e6c42aa2ceb0677b0ae29b90ianh</body></html>