6384N/A<!
DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
6384N/A<
TITLE>Apache module mod_log_config</
TITLE>
6384N/A<
H1>Module mod_log_config</
h1>
6384N/Acompiled in by default. It provides for logging of the requests made to
6384N/Athe server, using a user-specified format.
6384N/AThis is an EXPERIMENTAL module, which implements the TransferLog directive
6384N/A(same as the common log module), and an additional directive, LogFormat.
6384N/ABugs would not surprise me.<
P>
6384N/AThe argument to the <
A HREF="#logformat">LogFormat</
A> is a string, which can
6384N/Ainclude literal characters copied into the log files, and `%' directives as
6384N/A%
...l: Remote logname (from identd, if supplied)
6384N/A%
...u: Remote user (from auth; may be bogus if return
6384N/A%
...s: Status. For requests that got internally redirected,
6384N/A this is status of the <
b>original</
b> request --- %...>s
6384N/A%...{Foobar}i: The contents of Foobar: header line(s) in the request
6384N/A%...{Foobar}o: The contents of Foobar: header line(s) in the reply.
6384N/AThe `...' can be nothing at all (
e.g. <
code>"%h %u %r %s %b"</
code>), or it can
6384N/Aindicate conditions for inclusion of the item (which will cause it
6384N/Ato be replaced with `-' if the condition is not met). Note that
6384N/Athere is no escaping performed on the strings from %r, %
...i and
6384N/A%
...o; some with long memories may remember that I thought this was
6384N/Aa bad idea, once upon a time, and I'm still not comfortable with
6384N/Ait, but it is difficult to see how to `do the right thing' with all
6384N/Aof `%
..i', unless we URL-escape everything and break with CLF.
6384N/AThe forms of condition are a list of HTTP status codes, which may
6384N/Aor may not be preceded by `!'. Thus, `%400,501{User-agent}i' logs
6384N/AUser-agent: on 400 errors and 501 errors (Bad Request, Not
6384N/AImplemented) only; `%!200,304,302{Referer}i' logs Referer: on all
6384N/Arequests which did <
b>not</
b> return some sort of normal status.
7151N/AThe default LogFormat reproduces CLF; see below.
6384N/AThe way this is supposed to work with virtual hosts is as follows:
6384N/Aa virtual host can have its own LogFormat, or its own TransferLog.
6384N/AIf it doesn't have its own LogFormat, it inherits from the main
6384N/Aserver. If it doesn't have its own TransferLog, it writes to the
6384N/Asame descriptor (meaning the same process for `| ...').
6384N/AThat means that you can do things like:
LogFormat "hostb ..."<
br>
</VirtualHost></
code></
blockquote>
... to have different virtual servers write into the same log file,
but have some indication which host they came from, though a %v
directive may well be a better way to handle this. Look for more
changes to come to this format.<
p>
<
li><
A HREF="#logformat">LogFormat</
A>
<
li><
A HREF="#transferlog">TransferLog</
A>
<
A name="logformat"><
h2>LogFormat</
h2></
A>
<!--%plaintext <?INDEX {\tt LogFormat} directive> --> <
strong>Syntax:</
strong> LogFormat <
em>string</
em><
br>
<
strong>Default:</
strong> <
code>LogFormat "%h %l %u %t \"%r\"
<
Strong>Context:</
strong> server config, virtual host<
br>
<
strong>Status:</
strong> Experimental<
br>
<
strong>Module:</
strong> mod_log_config<
p>
This sets the format of the logfile.<
p><
hr>
<
A name="transferlog"><
h2>TransferLog</
h2></
A>
<!--%plaintext <?INDEX {\tt TransferLog} directive> --> <
strong>Syntax:</
strong> TransferLog <
em>file-pipe</
em><
br>
<
Strong>Context:</
strong> server config, virtual host<
br>
<
strong>Status:</
strong> Experimental<
br>
<
strong>Module:</
strong> mod_log_config<
p>
The TransferLog directive sets the name of the file to which the server will
log the incoming requests. <
em>File-pipe</
em> is one
<
dd>A filename relative to the <
A HREF="core.html#serverroot">ServerRoot</
A>.
<
dt> `|' followed by a command
<
dd>A program to receive the agent log information on its standard input.
Note the a new program will not be started for a VirtualHost if it inherits
the TransferLog from the main server.
<
strong>Security:</
strong> if a program is used, then it will be
run under the user who started httpd. This will be root if the server
was started by root; be sure that the program is secure.<
p>