mod_log_config.html revision ac6d1ce7ccb1950bb2145a5c2c3498235353bcb0
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen GallagherXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher This file is generated from xml source: DO NOT EDIT
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen GallagherXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher--><title>mod_log_config - Apache HTTP Server</title><link href="/style/manual.css" type="text/css" rel="stylesheet"/></head><body><blockquote><div align="center"><img alt="[APACHE DOCUMENTATION]" src="/images/sub.gif"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module mod_log_config</h1><table cellspacing="1" cellpadding="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td valign="top"><span class="help">Description:</span></td><td>Logging of the requests made to the server</td></tr><tr><td><a href="module-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="module-dict.html#ModuleIdentifier" class="help">Module Identifier:</a></td><td>log_config_module</td></tr></table></td></tr></table><h2>Summary</h2>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>This module provides for flexible logging of client
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher requests. Logs are written in a customizable format, and may be
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher written directly to a file, or to an external program.
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher Conditional logging is provided so that individual requests may
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher be included or excluded from the logs based on characteristics
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher of the request.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>Three directives are provided by this module:
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <code>TransferLog</code> to create a log file,
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <code>LogFormat</code> to set a custom format, and
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <code>CustomLog</code> to define a log file and format in one
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher step. The <code>TransferLog</code> and <code>CustomLog</code>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher directives can be used multiple times in each server to cause
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher each request to be logged to multiple files.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<h2>Directives</h2><ul><li><a href="#cookielog">CookieLog</a></li><li><a href="#customlog">CustomLog</a></li><li><a href="#logformat">LogFormat</a></li><li><a href="#transferlog">TransferLog</a></li></ul><p><strong>See also </strong></p><ul><li><a href="/logs.html">Apache Log Files</a></li></ul><h2><a name="formats">Custom Log Formats</a></h2>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The format argument to the <code>LogFormat</code> and
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <code>CustomLog</code> directives is a string. This string is
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher logged to the log file for each request. It can contain literal
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher characters copied into the log files and the c-type control
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher characters "\n" and "\t" to represent new-lines and tabs.
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher Literal quotes and back-slashes should be escaped with
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher back-slashes.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The characteristics of the request itself are logged by
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher placing "%" directives in the format string, which are replaced
f6cd1236c27817b97db002094b76648d92b55f82Jan Zeleny in the log file by the values as follows:</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>Bytes sent, excluding HTTP headers.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>Bytes sent, excluding HTTP headers. In CLF format
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagheri.e. a '-' rather than a 0 when no bytes are sent.</td></tr>
db26b4a6f2be8f087987ee6b15008b16350174d0Pavel Březina<td>The contents of cookie "Foobar" in the request sent to the server.</td></tr>
9af677f3bae3a7c1386867e4d42970555b3d6b9aPavel Březina<td>The time taken to serve the request, in microseconds.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The contents of the environment variable FOOBAR</td></tr>
d38cd6a211d3b68036ceb7bc875f832433afd035Stephen Gallagher<td>The contents of Foobar: header line(s) in the request
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>Remote logname (from identd, if supplied)</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The contents of note "Foobar" from another module.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The contents of Foobar: header line(s) in the reply.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The canonical Port of the server serving the request</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The process ID of the child that serviced the request.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The query string (prepended with a ? if a query string exists,
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>Status. For requests that got internally redirected, this is
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagherthe status of the *original* request --- %...>s for the last.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>Time, in common log format time format (standard english format)</td></tr>
419ddca29f074cf446c316b735fbbafc59084458Stephen Gallagher<td>The time, in the form given by format, which should
ceb40cb8846ff755f841466908954087f927eae7Jakub Hrozekbe in strftime(3) format. (potentially localized)</td></tr>
2fd5864ac8eb2c4cfa0fafe7c0431a74f2ebe1fbStephen Gallagher<td>The time taken to serve the request, in seconds.</td></tr>
3963d3fa9e3099bc02d612b5051d8b769d6e3a75Stephen Gallagher<td>Remote user (from auth; may be bogus if return status (%s) is 401)</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The URL path requested, not including any query string.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The canonical ServerName of the server serving the request.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>The server name according to the UseCanonicalName setting.</td></tr>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<td>Connection status when response is completed.
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher'X' = connection aborted before the response completed.<br>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher'+' = connection may be kept alive after the response is sent.<br>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher'-' = connection will be closed after the response is sent.
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<blockquote><table><tr><td bgcolor="#e0e5f5">(This directive was %...c in late versions of Apache 1.3, but
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagherthis conflicted with the historical ssl %...{var}c syntax.)</td></tr></table></blockquote>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The "..." can be nothing at all (<em>e.g.</em>, <code>"%h %u
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher %r %s %b"</code>), or it can indicate conditions for inclusion
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher of the item (which will cause it to be replaced with "-" if the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher condition is not met). The forms of condition are a list of
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher HTTP status codes, which may or may not be preceded by "!".
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher Thus, "%400,501{User-agent}i" logs User-agent: on 400 errors
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher and 501 errors (Bad Request, Not Implemented) only;
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher "%!200,304,302{Referer}i" logs Referer: on all requests which
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher did <strong>not</strong> return some sort of normal status.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>Note that there is no escaping performed on the strings from
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher %...r, %...i and %...o. This is mainly to comply with the
4f07a5ba197b902afd3a785baf6bd9967f50dfd2Stephen Gallagher requirements of the Common Log Format. This implies that
532eb49e129bedf57cdbd0a66f39ad228b8f2482Stephen Gallagher clients can insert control characters into the log, so care
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher should be taken when dealing with raw log files.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>Some commonly used log format strings are:</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <dd><code>"%h %l %u %t \"%r\" %>s %b"</code></dd>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <dt>Common Log Format with Virtual Host</dt>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <dd><code>"%v %h %l %u %t \"%r\" %>s %b"</code></dd>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <dt>NCSA extended/combined log format</dt>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <dd><code>"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher <dd><code>"%{Referer}i -> %U"</code></dd>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>Note that the canonical <a href="core.html#servername">ServerName</a> and <a href="mpm_common.html#listen">Listen</a> of the server serving the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher request are used for <code>%v</code> and <code>%p</code>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher respectively. This happens regardless of the <a href="core.html#usecanonicalname">UseCanonicalName</a> setting
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher because otherwise log analysis programs would have to duplicate
4f07a5ba197b902afd3a785baf6bd9967f50dfd2Stephen Gallagher the entire vhost matching algorithm in order to decide what
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher host really served the request.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>See the <a href="/misc/security_tips.html#serverroot">security tips</a>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher document for details on why your security could be compromised
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher if the directory where logfiles are stored is writable by
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher anyone other than the user that starts the server.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <hr/><h2><a name="CookieLog">CookieLog</a> <a name="cookielog">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets filename for the logging of cookies</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>CookieLog <em>filename</em></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagherhost</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_log_config</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>Only available in Apache 1.2 and above</td></tr></table></td></tr></table>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The <code class="directive">CookieLog</code> directive sets the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher filename for logging of cookies. The filename is relative to the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <a href="core.html#serverroot" class="directive"><code class="directive">serverroot</code></a>. This directive is
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher included only for compatibility with <code><a href="mod_cookies.html">mod_cookies</a></code>,
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher and is deprecated.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<hr/><h2><a name="CustomLog">CustomLog</a> <a name="customlog">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets filename and format of log file</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>CustomLog
4f07a5ba197b902afd3a785baf6bd9967f50dfd2Stephen Gallagher <em>file</em>|<em>pipe</em> <em>format</em>|<em>nickname</em>
532eb49e129bedf57cdbd0a66f39ad228b8f2482Stephen Gallagher [env=[!]<em>environment-variable</em>]</td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagherhost</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_log_config</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>Nickname only available in Apache 1.3 or later.
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen GallagherConditional logging available in 1.3.5 or later.</td></tr></table></td></tr></table>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The <code class="directive">CustomLog</code> directive is used to
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher log requests to the server. A log format is specified, and the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher logging can optionally be made conditional on request
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher characteristics using environment variables.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The first argument, which specifies the location to which
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher the logs will be written, can take on one of the following two
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher types of values:</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <dd>A filename, relative to the <a href="core.html#serverroot">ServerRoot</a>.</dd>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <dd>The pipe character "<code>|</code>", followed by the path
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher to a program to receive the log information on its standard
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher input. <strong>Security:</strong> if a program is used, then
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher it will be run under the user who started httpd. This will be
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher root if the server was started by root; be sure that the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher program is secure.</dd>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The second argument specifies what will be written to the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher log file. It can specify either a <em>nickname</em> defined by
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher a previous <a href="#logformat">LogFormat</a> directive, or it
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher can be an explicit <em>format</em> string as described in the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <a href="#formats">log formats</a> section.</p>
4f07a5ba197b902afd3a785baf6bd9967f50dfd2Stephen Gallagher <p>For example, the following two sets of directives have
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher exactly the same effect:</p>
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher # CustomLog with format nickname<br>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher LogFormat "%h %l %u %t \"%r\" %>s %b" common<br>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher # CustomLog with explicit format string<br>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"<br>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The third argument is optional and allows the decision on
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher whether or not to log a particular request to be based on the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher presence or absence of a particular variable in the server
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher environment. If the specified <a href="/env.html">environment
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher variable</a> is set for the request (or is not set, in the case
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher of a '<code>env=!<em>name</em></code>' clause), then the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher request will be logged.</p>
532eb49e129bedf57cdbd0a66f39ad228b8f2482Stephen Gallagher <p>Environment variables can be set on a <em>per</em>-request
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher basis using the <code><a href="mod_setenvif.html">mod_setenvif</a></code>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher and/or <code><a href="mod_rewrite.html">mod_rewrite</a></code> modules. For
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher example, if you don't want to record requests for all GIF
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher images on your server in a separate logfile but not your main
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher log, you can use:</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher SetEnvIf Request_URI \.gif$ gif-image<br>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher CustomLog gif-requests.log common env=gif-image<br>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher CustomLog nongif-requests.log common env=!gif-image
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<hr/><h2><a name="LogFormat">LogFormat</a> <a name="logformat">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Describes a format for use in a log file</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>LogFormat
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <em>format</em>|<em>nickname</em> [<em>nickname</em>]</td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagherhost</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_log_config</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>Nickname only available in Apache 1.3 or later.
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>This directive specifies the format of the access log
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The <code class="directive">LogFormat</code> directive can take one of two
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher forms. In the first form, where only one argument is specified,
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher this directive sets the log format which will be used by logs
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher specified in subsequent <code class="directive">TransferLog</code>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher directives. The single argument can specify an explicit
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <em>format</em> as discussed in <a href="#formats">custom log
42aeb975864c3c3ba971fd04c61a1aaf6e69905bStephen Gallagher formats</a> section above. Alternatively, it can use a
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <em>nickname</em> to refer to a log format defined in a
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher previous <code class="directive">LogFormat</code> directive as described
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <p>The second form of the <code class="directive">LogFormat</code>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher directive associates an explicit <em>format</em> with a
4f07a5ba197b902afd3a785baf6bd9967f50dfd2Stephen Gallagher <em>nickname</em>. This <em>nickname</em> can then be used in
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher subsequent <code class="directive">LogFormat</code> or
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher <code class="directive">CustomLog</code> directives rather than
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher repeating the entire format string. A
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher directive which defines a nickname <strong>does nothing
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher else</strong> -- that is, it <em>only</em> defines the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher nickname, it doesn't actually apply the format and make it the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher default. Therefore, it will not affect subsequent
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher <code class="directive">TransferLog</code> directives.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<hr/><h2><a name="TransferLog">TransferLog</a> <a name="transferlog">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Specifly location of a log file</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>TransferLog <em>file</em>|<em>pipe</em></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagherhost</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_log_config</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td/></tr></table></td></tr></table>
e980f8b95f2fb89e872babffdd94b3ccb2d42ccfStephen Gallagher <p>This directive has exactly the same arguments and effect as
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher the <code class="directive">CustomLog</code> directive, with the
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher exception that it does not allow the log format to be specified
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher explicitly or for conditional logging of requests. Instead, the
fb4e4c4eb6a6dc732370584f70d23dd4a2c5c7b6Pavel Březina log format is determined by the most recently specified
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher specified <code class="directive">LogFormat</code> directive (which
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher does not define a nickname). Common Log Format is used if no
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher other format has been specified.</p>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
65e8f538ad35ba7d86cd9e60a3d86aec34537027Stephen Gallagher LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""<br>
c8704f06db6dbbe39f50dfb35f20cdf27cf1f087Pavel Březina<hr/><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img alt="Index" src="/images/index.gif"/></a><a href="../"><img alt="Home" src="/images/home.gif"/></a></blockquote></body></html>