1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mod_log_config - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <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>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_log_config</h1>
24 <p><span>Available Languages: </span><a href="../en/mod/mod_log_config.html" title="English"> en </a> |
25 <a href="../ja/mod/mod_log_config.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
26 <a href="../ko/mod/mod_log_config.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
27 <a href="../tr/mod/mod_log_config.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
29 <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>
30 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
31 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>log_config_module</td></tr>
32 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_log_config.c</td></tr></table>
35 <p>This module provides for flexible logging of client
36 requests. Logs are written in a customizable format, and may be
37 written directly to a file, or to an external program.
38 Conditional logging is provided so that individual requests may
39 be included or excluded from the logs based on characteristics
42 <p>Three directives are provided by this module:
43 <code class="directive"><a href="#transferlog">TransferLog</a></code> to create
44 a log file, <code class="directive"><a href="#logformat">LogFormat</a></code>
45 to set a custom format, and <code class="directive"><a href="#customlog">CustomLog</a></code> to define a log file and format in one
46 step. The <code class="directive">TransferLog</code> and <code class="directive">CustomLog</code> directives can be used multiple times in each
47 server to cause each request to be logged to multiple files.</p>
49 <div id="quickview"><h3 class="directives">Directives</h3>
51 <li><img alt="" src="../images/down.gif" /> <a href="#bufferedlogs">BufferedLogs</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#customlog">CustomLog</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#logformat">LogFormat</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#transferlog">TransferLog</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#formats">Custom Log Formats</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#security">Security Considerations</a></li>
60 </ul><h3>See also</h3>
62 <li><a href="../logs.html">Apache Log Files</a></li>
64 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
66 <h2><a name="formats" id="formats">Custom Log Formats</a></h2>
68 <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
69 used to log each request to the log file. It can contain literal
70 characters copied into the log files and the C-style control
71 characters "\n" and "\t" to represent new-lines and tabs.
72 Literal quotes and backslashes should be escaped with
75 <p>The characteristics of the request itself are logged by
76 placing "<code>%</code>" directives in the format string, which are
77 replaced in the log file by the values as follows:</p>
79 <table class="bordered"><tr class="header"><th>Format String</th>
80 <th>Description</th></tr>
81 <tr><td><code>%%</code></td>
82 <td>The percent sign.</td></tr>
83 <tr class="odd"><td><code>%a</code></td>
84 <td>Remote IP-address.</td></tr>
85 <tr><td><code>%A</code></td>
86 <td>Local IP-address.</td></tr>
87 <tr class="odd"><td><code>%B</code></td>
88 <td>Size of response in bytes, excluding HTTP headers.</td></tr>
89 <tr><td><code>%b</code></td>
90 <td>Size of response in bytes, excluding HTTP headers. In CLF format, <em>i.e.</em>
91 a '<code>-</code>' rather than a 0 when no bytes are sent.</td></tr>
92 <tr class="odd"><td><code>%{<var>VARNAME</var>}C</code></td>
93 <td>The contents of cookie <var>VARNAME</var> in the request sent
94 to the server. Only version 0 cookies are fully supported.</td></tr>
95 <tr><td><code>%D</code></td>
96 <td>The time taken to serve the request, in microseconds.</td></tr>
97 <tr class="odd"><td><code>%{<var>VARNAME</var>}e</code></td>
98 <td>The contents of the environment variable
99 <var>VARNAME</var>.</td></tr>
100 <tr><td><code>%f</code></td>
101 <td>Filename.</td></tr>
102 <tr class="odd"><td><code>%h</code></td>
103 <td>Remote hostname. Will log the IP address if <code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code> is set to
104 <code>Off</code>, which is the default. If it logs the hostname
105 for only a few hosts, you probably have access control
106 directives mentioning them by name. See <a href="mod_authz_host.html#reqhost">the Require host
107 documentation</a>.</td></tr>
108 <tr><td><code>%H</code></td>
109 <td>The request protocol.</td></tr>
110 <tr class="odd"><td><code>%{<var>VARNAME</var>}i</code></td>
111 <td>The contents of <code><var>VARNAME</var>:</code> header line(s)
112 in the request sent to the server. Changes made by other
113 modules (e.g. <code class="module"><a href="../mod/mod_headers.html">mod_headers</a></code>) affect this.
115 <tr><td><code>%k</code></td>
116 <td>Number of keepalive requests handled on this connection. Interesting if
117 <code class="directive"><a href="../mod/core.html#keepalive">KeepAlive</a></code> is being used, so that,
118 for example, a '1' means the first keepalive request after the initial
119 one, '2' the second, etc...;
120 otherwise this is always 0 (indicating the initial request).</td></tr>
121 <tr class="odd"><td><code>%l</code></td>
122 <td>Remote logname (from identd, if supplied). This will return a
123 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
124 <code>On</code>.</td></tr>
125 <tr><td><code>%L</code></td>
126 <td>The request log ID from the error log (or '-' if nothing has been
127 logged to the error log for this request). Look for the
128 matching error log line to see what request caused what error.</td></tr>
129 <tr class="odd"><td><code>%m</code></td>
130 <td>The request method.</td></tr>
131 <tr><td><code>%{<var>VARNAME</var>}n</code></td>
132 <td>The contents of note <var>VARNAME</var> from another
134 <tr class="odd"><td><code>%{<var>VARNAME</var>}o</code></td>
135 <td>The contents of <code><var>VARNAME</var>:</code> header line(s)
136 in the reply.</td></tr>
137 <tr><td><code>%p</code></td>
138 <td>The canonical port of the server serving the request.</td></tr>
139 <tr class="odd"><td><code>%{<var>format</var>}p</code></td>
140 <td>The canonical port of the server serving the request, or the
141 server's actual port, or the client's actual port. Valid formats
142 are <code>canonical</code>, <code>local</code>, or <code>remote</code>.
144 <tr><td><code>%P</code></td>
145 <td>The process ID of the child that serviced the request.</td></tr>
146 <tr class="odd"><td><code>%{<var>format</var>}P</code></td>
147 <td>The process ID or thread ID of the child that serviced the
148 request. Valid formats are <code>pid</code>, <code>tid</code>,
149 and <code>hextid</code>. <code>hextid</code> requires APR 1.2.0 or
152 <tr><td><code>%q</code></td>
153 <td>The query string (prepended with a <code>?</code> if a query
154 string exists, otherwise an empty string).</td></tr>
155 <tr class="odd"><td><code>%r</code></td>
156 <td>First line of request.</td></tr>
157 <tr><td><code>%R</code></td>
158 <td>The handler generating the response (if any).</td></tr>
159 <tr class="odd"><td><code>%s</code></td>
160 <td>Status. For requests that have been internally redirected, this is
161 the status of the <em>original</em> request. Use <code>%>s</code>
162 for the final status.</td></tr>
163 <tr><td><code>%t</code></td>
164 <td>Time the request was received, in the format <code>[18/Sep/2011:19:18:28 -0400]</code>.
165 The last number indicates the timezone offset from GMT</td></tr>
166 <tr class="odd"><td><code>%{<var>format</var>}t</code></td>
167 <td>The time, in the form given by format, which should be in
168 an extended <code>strftime(3)</code> format (potentially localized).
169 If the format starts with <code>begin:</code> (default) the time is taken
170 at the beginning of the request processing. If it starts with
171 <code>end:</code> it is the time when the log entry gets written,
172 close to the end of the request processing. In addition to the formats
173 supported by <code>strftime(3)</code>, the following format tokens are
176 <tr><td><code>sec</code></td><td>number of seconds since the Epoch</td></tr>
177 <tr><td><code>msec</code></td><td>number of milliseconds since the Epoch</td></tr>
178 <tr><td><code>usec</code></td><td>number of microseconds since the Epoch</td></tr>
179 <tr><td><code>msec_frac</code></td><td>millisecond fraction</td></tr>
180 <tr><td><code>usec_frac</code></td><td>microsecond fraction</td></tr>
182 These tokens can not be combined with each other or <code>strftime(3)</code>
183 formatting in the same format string. You can use multiple
184 <code>%{<var>format</var>}t</code> tokens instead.
186 <tr><td><code>%T</code></td>
187 <td>The time taken to serve the request, in seconds.</td></tr>
188 <tr class="odd"><td><code>%u</code></td>
189 <td>Remote user if the request was authenticated. May be bogus if return status
190 (<code>%s</code>) is 401 (unauthorized).</td></tr>
191 <tr><td><code>%U</code></td>
192 <td>The URL path requested, not including any query string.</td></tr>
193 <tr class="odd"><td><code>%v</code></td>
194 <td>The canonical <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code>
195 of the server serving the request.</td></tr>
196 <tr><td><code>%V</code></td>
197 <td>The server name according to the <code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code> setting.</td></tr>
198 <tr class="odd"><td><code>%X</code></td>
199 <td>Connection status when response is completed:
203 <tr><td><code>X</code> =</td>
204 <td>Connection aborted before the response completed.</td></tr>
205 <tr><td><code>+</code> =</td>
206 <td>Connection may be kept alive after the response is
208 <tr><td><code>-</code> = </td>
209 <td>Connection will be closed after the response is
214 <tr><td><code>%I</code></td>
215 <td>Bytes received, including request and headers. Cannot be zero.
216 You need to enable <code class="module"><a href="../mod/mod_logio.html">mod_logio</a></code> to use this.</td></tr>
217 <tr class="odd"><td><code>%O</code></td>
218 <td>Bytes sent, including headers. Cannot be zero. You need to
219 enable <code class="module"><a href="../mod/mod_logio.html">mod_logio</a></code> to use this.</td></tr>
222 <h3><a name="modifiers" id="modifiers">Modifiers</a></h3>
224 <p>Particular items can be restricted to print only for
225 responses with specific HTTP status codes by placing a
226 comma-separated list of status codes immediately following the
227 "%". The status code list may be peceded by a "<code>!</code>" to
228 indicate negation.</p>
230 <table class="bordered"><tr class="header"><th>Format String</th>
231 <th>Meaning</th></tr>
233 <td><code>%400,501{User-agent}i</code></td>
234 <td>Logs <code>User-agent</code> on 400 errors and 501 errors only. For
235 other status codes, the literal string <code>"-"</code> will be
237 <tr class="odd"><td><code>%!200,304,302{Referer}i</code></td>
238 <td>Logs <code>Referer</code> on all requests that do
239 <em>not</em> return one of the three specified codes,
240 "<code>-</code>" otherwise.
244 <p>The modifiers "<" and ">" can be used for requests that
245 have been internally redirected to choose whether the original
246 or final (respectively) request should be consulted. By
247 default, the <code>%</code> directives <code>%s, %U, %T,
248 %D,</code> and <code>%r</code> look at the original request
249 while all others look at the final request. So for example,
250 <code>%>s</code> can be used to record the final status of
251 the request and <code>%<u</code> can be used to record the
252 original authenticated user on a request that is internally
253 redirected to an unauthenticated resource.</p>
257 <h3><a name="format-notes" id="format-notes">Format Notes</a></h3>
259 <p>For security reasons, starting with version 2.0.46,
260 non-printable and other special characters in <code>%r</code>,
261 <code>%i</code> and <code>%o</code> are escaped using
262 <code>\x<var>hh</var></code> sequences, where <var>hh</var>
263 stands for the hexadecimal representation of the raw
264 byte. Exceptions from this rule are <code>"</code> and
265 <code>\</code>, which are escaped by prepending a backslash, and
266 all whitespace characters, which are written in their C-style
267 notation (<code>\n</code>, <code>\t</code>, etc). In versions
268 prior to 2.0.46, no escaping was performed on these strings so
269 you had to be quite careful when dealing with raw log files.</p>
271 <p>In httpd 2.0, unlike 1.3, the <code>%b</code> and
272 <code>%B</code> format strings do not represent the number of
273 bytes sent to the client, but simply the size in bytes of the
274 HTTP response (which will differ, for instance, if the
275 connection is aborted, or if SSL is used). The <code>%O</code>
276 format provided by <code class="module"><a href="../mod/mod_logio.html">mod_logio</a></code> will log the
277 actual number of bytes sent over the network.</p>
280 <p>Note: <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> is implemented as a
281 quick-handler and not as a standard handler. Therefore, the
282 <code>%R</code> format string will not return any handler
283 information when content caching is involved.</p>
288 <h3><a name="examples" id="examples">Examples</a></h3>
290 <p>Some commonly used log format strings are:</p>
293 <dt>Common Log Format (CLF)</dt>
294 <dd><code>"%h %l %u %t \"%r\" %>s %b"</code></dd>
296 <dt>Common Log Format with Virtual Host</dt>
297 <dd><code>"%v %h %l %u %t \"%r\" %>s %b"</code></dd>
299 <dt>NCSA extended/combined log format</dt>
300 <dd><code>"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
301 \"%{User-agent}i\""</code></dd>
303 <dt>Referer log format</dt>
304 <dd><code>"%{Referer}i -> %U"</code></dd>
306 <dt>Agent (Browser) log format</dt>
307 <dd><code>"%{User-agent}i"</code></dd>
310 <p>You can use the <code>%{format}t</code> directive multiple
311 times to build up a time format using the extended format tokens
312 like <code>msec_frac</code>:</p>
314 <dt>Timestamp including milliseconds</dt>
315 <dd><code>"%{%d/%b/%Y %T}t.%{msec_frac}t %{%z}t"</code></dd>
320 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
321 <div class="section">
322 <h2><a name="security" id="security">Security Considerations</a></h2>
323 <p>See the <a href="../misc/security_tips.html#serverroot">security tips</a>
324 document for details on why your security could be compromised
325 if the directory where logfiles are stored is writable by
326 anyone other than the user that starts the server.</p>
328 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
329 <div class="directive-section"><h2><a name="BufferedLogs" id="BufferedLogs">BufferedLogs</a> <a name="bufferedlogs" id="bufferedlogs">Directive</a></h2>
330 <table class="directive">
331 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Buffer log entries in memory before writing to disk</td></tr>
332 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BufferedLogs On|Off</code></td></tr>
333 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>BufferedLogs Off</code></td></tr>
334 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
335 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
336 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
337 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in versions 2.0.41 and later.</td></tr>
339 <p>The <code class="directive">BufferedLogs</code> directive causes
340 <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code> to store several log entries in
341 memory and write them together to disk, rather than writing them
342 after each request. On some systems, this may result in more
343 efficient disk access and hence higher performance. It may be
344 set only once for the entire server; it cannot be configured
345 per virtual-host.</p>
347 <div class="note">This directive should be used with caution as a crash might
348 cause loss of logging data.</div>
351 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
352 <div class="directive-section"><h2><a name="CustomLog" id="CustomLog">CustomLog</a> <a name="customlog" id="customlog">Directive</a></h2>
353 <table class="directive">
354 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets filename and format of log file</td></tr>
355 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CustomLog <var>file</var>|<var>pipe</var>
356 <var>format</var>|<var>nickname</var>
357 [env=[!]<var>environment-variable</var>|
358 expr=<var>expression</var>]</code></td></tr>
359 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
360 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
361 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
363 <p>The <code class="directive">CustomLog</code> directive is used to
364 log requests to the server. A log format is specified, and the
365 logging can optionally be made conditional on request
366 characteristics using environment variables.</p>
368 <p>The first argument, which specifies the location to which
369 the logs will be written, can take one of the following two
373 <dt><var>file</var></dt>
374 <dd>A filename, relative to the <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>.</dd>
376 <dt><var>pipe</var></dt>
377 <dd>The pipe character "<code>|</code>", followed by the path
378 to a program to receive the log information on its standard
379 input. See the notes on <a href="../logs.html#piped">piped logs</a>
380 for more information.
382 <div class="warning"><h3>Security:</h3>
383 <p>If a program is used, then it will be run as the user who
384 started <code class="program"><a href="../programs/httpd.html">httpd</a></code>. This will be root if the server was
385 started by root; be sure that the program is secure.</p>
387 <div class="warning"><h3>Note</h3>
388 <p>When entering a file path on non-Unix platforms, care should be taken
389 to make sure that only forward slashed are used even though the platform
390 may allow the use of back slashes. In general it is a good idea to always
391 use forward slashes throughout the configuration files.</p>
395 <p>The second argument specifies what will be written to the
396 log file. It can specify either a <var>nickname</var> defined by
397 a previous <code class="directive"><a href="#logformat">LogFormat</a></code>
398 directive, or it can be an explicit <var>format</var> string as
399 described in the <a href="#formats">log formats</a> section.</p>
401 <p>For example, the following two sets of directives have
402 exactly the same effect:</p>
404 <div class="example"><p><code>
405 # CustomLog with format nickname<br />
406 LogFormat "%h %l %u %t \"%r\" %>s %b" common<br />
407 CustomLog logs/access_log common<br />
409 # CustomLog with explicit format string<br />
410 CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"
413 <p>The third argument is optional and controls whether or
414 not to log a particular request. The condition can be the
415 presence or absence (in the case of a '<code>env=!<var>name</var></code>'
416 clause) of a particular variable in the server
417 <a href="../env.html">environment</a>. Alternatively, the condition
418 can be expressed as arbitrary boolean <a href="../expr.html">expression</a>. If the condition is not satisfied, the request
419 will not be logged.</p>
421 <p>Environment variables can be set on a per-request
422 basis using the <code class="module"><a href="../mod/mod_setenvif.html">mod_setenvif</a></code>
423 and/or <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> modules. For
424 example, if you want to record requests for all GIF
425 images on your server in a separate logfile but not in your main
426 log, you can use:</p>
428 <div class="example"><p><code>
429 SetEnvIf Request_URI \.gif$ gif-image<br />
430 CustomLog gif-requests.log common env=gif-image<br />
431 CustomLog nongif-requests.log common env=!gif-image
434 <p>Or, to reproduce the behavior of the old RefererIgnore
435 directive, you might use the following:</p>
437 <div class="example"><p><code>
438 SetEnvIf Referer example\.com localreferer<br />
439 CustomLog referer.log referer env=!localreferer
443 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
444 <div class="directive-section"><h2><a name="LogFormat" id="LogFormat">LogFormat</a> <a name="logformat" id="logformat">Directive</a></h2>
445 <table class="directive">
446 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Describes a format for use in a log file</td></tr>
447 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LogFormat <var>format</var>|<var>nickname</var>
448 [<var>nickname</var>]</code></td></tr>
449 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LogFormat "%h %l %u %t \"%r\" %>s %b"</code></td></tr>
450 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
451 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
452 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
454 <p>This directive specifies the format of the access log
457 <p>The <code class="directive">LogFormat</code> directive can take one of two
458 forms. In the first form, where only one argument is specified,
459 this directive sets the log format which will be used by logs
460 specified in subsequent <code class="directive">TransferLog</code>
461 directives. The single argument can specify an explicit
462 <var>format</var> as discussed in the <a href="#formats">custom log
463 formats</a> section above. Alternatively, it can use a
464 <var>nickname</var> to refer to a log format defined in a
465 previous <code class="directive">LogFormat</code> directive as described
468 <p>The second form of the <code class="directive">LogFormat</code>
469 directive associates an explicit <var>format</var> with a
470 <var>nickname</var>. This <var>nickname</var> can then be used in
471 subsequent <code class="directive">LogFormat</code> or
472 <code class="directive"><a href="#customlog">CustomLog</a></code> directives
473 rather than repeating the entire format string. A
474 <code class="directive">LogFormat</code> directive that defines a nickname
475 <strong>does nothing else</strong> -- that is, it <em>only</em>
476 defines the nickname, it doesn't actually apply the format and make
477 it the default. Therefore, it will not affect subsequent
478 <code class="directive"><a href="#transferlog">TransferLog</a></code> directives.
479 In addition, <code class="directive">LogFormat</code> cannot use one nickname
480 to define another nickname. Note that the nickname should not contain
481 percent signs (<code>%</code>).</p>
483 <div class="example"><h3>Example</h3><p><code>
484 LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common
488 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
489 <div class="directive-section"><h2><a name="TransferLog" id="TransferLog">TransferLog</a> <a name="transferlog" id="transferlog">Directive</a></h2>
490 <table class="directive">
491 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify location of a log file</td></tr>
492 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TransferLog <var>file</var>|<var>pipe</var></code></td></tr>
493 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
494 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
495 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_log_config</td></tr>
497 <p>This directive has exactly the same arguments and effect as
498 the <code class="directive"><a href="#customlog">CustomLog</a></code>
499 directive, with the exception that it does not allow the log format
500 to be specified explicitly or for conditional logging of requests.
501 Instead, the log format is determined by the most recently specified
502 <code class="directive"><a href="#logformat">LogFormat</a></code> directive
503 which does not define a nickname. Common Log Format is used if no
504 other format has been specified.</p>
506 <div class="example"><h3>Example</h3><p><code>
507 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""<br />
508 TransferLog logs/access_log
513 <div class="bottomlang">
514 <p><span>Available Languages: </span><a href="../en/mod/mod_log_config.html" title="English"> en </a> |
515 <a href="../ja/mod/mod_log_config.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
516 <a href="../ko/mod/mod_log_config.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
517 <a href="../tr/mod/mod_log_config.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
518 </div><div id="footer">
519 <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>
520 <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>