mod_log_config.html revision 3d76f0e292da6a107829fbe83f98b8c0985c6ddb
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin<!--%hypertext -->
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin<!--/%hypertext -->
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThis module is contained in the <code>mod_log_config.c</code> file, and is not
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincompiled in by default. It provides for logging of the requests made to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthe server, using a user-specified format.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThis is an EXPERIMENTAL module, which implements the TransferLog directive
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin(same as the common log module), and an additional directive, LogFormat.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinBugs would not surprise me.<P>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe argument to the <A HREF="#logformat">LogFormat</A> is a string, which can
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininclude literal characters copied into the log files, and `%' directives as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...h: Remote host
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...l: Remote logname (from identd, if supplied)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...u: Remote user (from auth; may be bogus if return
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin status (%s) is 401)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...t: Time, in common log format time format
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...r: First line of request
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...s: Status. For requests that got internally redirected,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin this is status of the <b>original</b> request --- %...>s
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for the last.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...b: Bytes sent.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...{Foobar}i: The contents of Foobar: header line(s) in the request
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin sent to the client.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...{Foobar}o: The contents of Foobar: header line(s) in the reply.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe `...' can be nothing at all (e.g. <code>"%h %u %r %s %b"</code>), or it can
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinindicate conditions for inclusion of the item (which will cause it
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinto be replaced with `-' if the condition is not met). Note that
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthere is no escaping performed on the strings from %r, %...i and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin%...o; some with long memories may remember that I thought this was
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968china bad idea, once upon a time, and I'm still not comfortable with
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinit, but it is difficult to see how to `do the right thing' with all
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinof `%..i', unless we URL-escape everything and break with CLF.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe forms of condition are a list of HTTP status codes, which may
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinor may not be preceded by `!'. Thus, `%400,501{User-agent}i' logs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinUser-agent: on 400 errors and 501 errors (Bad Request, Not
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinImplemented) only; `%!200,304,302{Referer}i' logs Referer: on all
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinrequests which did <b>not</b> return some sort of normal status.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe default LogFormat reproduces CLF; see below.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe way this is supposed to work with virtual hosts is as follows: