From 843186b9d773e669472b2a92dfb7c134df4ade1d Mon Sep 17 00:00:00 2001 From: pcs Date: Tue, 26 Nov 1996 09:21:41 +0000 Subject: [PATCH] Document the Common Log Format Document the new % directives (p, P, T, {}n) Explain how to use multiple log files w/vhosts Expand CustomLog definition Add compat. note about CookieLog git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@77067 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/mod_log_config.html | 163 +++++++++++++++++++++------- 1 file changed, 123 insertions(+), 40 deletions(-) diff --git a/docs/manual/mod/mod_log_config.html b/docs/manual/mod/mod_log_config.html index 543a25b65f..19c47bc1f3 100644 --- a/docs/manual/mod/mod_log_config.html +++ b/docs/manual/mod/mod_log_config.html @@ -12,27 +12,113 @@ This module is contained in the mod_log_config.c file, and is compiled in by default in Apache 1.2. mod_log_config replaces mod_log_common in Apache 1.2. Prior to version 1.2, mod_log_config was an optional module. It provides for logging of the requests made to -the server, using a user-specified format. +the server, using the Common Log Format or a user-specified format.

Summary

-The argument to the LogFormat is a string, which can -include literal characters copied into the log files, and `%' directives as -follows: + +Three directives are provided by this module: TransferLog +to create a log file, LogFormat to set a custom format, +and CustomLog to define a log file and format in one go. +The TransferLog and CustomLog directives can +be use multiple times in each server to cause each request to be +logged to multiple files. +

+ +

Compatibility notes

+ + + +

Log File Formats

+ +Unless told otherwise with LogFormat the log files created by +TransferLog will be in standard "Common Log Format" +(CLF). The contents of each line in a CLF file are explained +below. Alternatively, the log file can be customised (and if multiple +log files are used, each can have a different format). Custom formats +are set with LogFormat and CustomLog. + +

Common Log Format

+ +The Common Log Format (CLF) file contains a separate line for each +request. A line is composed of several tokens separated by spaces: + +
+host ident authuser date request status bytes +
+If a token does not have a value then it is represented by a hyphen (-). +The meanings and values of these tokens are as follows: +
+
host +
The fully-qualified domain name of the client, or its IP number if the +name is not available. +
ident +
If IdentityCheck is enabled and the +client machine runs identd, then this is the identity information reported +by the client. +
authuser +
If the request was for an password protected document, then this is +the userid used in the request. +
date +
The date and time of the request, in the following format: +
date = [day/month/year:hour:minute:second zone]
+day = 2*digit
+month = 3*letter
+year = 4*digit
+hour = 2*digit
+minute = 2*digit
+second = 2*digit
+zone = (`+' | `-') 4*digit
+
request +
The request line from the client, enclosed in double quotes +("). +
status +
The three digit status code returned to the client. +
bytes +
The number of bytes in the object returned to the client, not including +any headers. +
+ +

Custom Log Formats

+ +The format argument to the LogFormat and +CustomLog is a string. This string is logged to the log +file for each request. It can contain literal characters copied into +the log files, and `%' directives which are replaced in the log file +by the values as follows:
+%...b:          Bytes sent.
+%...f:          Filename
 %...h:          Remote host
 %...l:          Remote logname (from identd, if supplied)
-%...u:          Remote user (from auth; may be bogus if return 
-                status (%s) is 401)
-%...t:          Time, in common log format time format
+%...p:          The port request was received on
+%...P:          The process ID of the child that serviced the request
 %...r:          First line of request
 %...s:          Status.  For requests that got internally redirected, 
                 this is status of the original request --- %...>s 
                 for the last.
-%...b:          Bytes sent.
+%...t:          Time, in common log format time format
+%...T:          The time taken to serve the request, in seconds
+%...u:          Remote user (from auth; may be bogus if return 
+                status (%s) is 401)
+%...U:          The URL path requested
+%...v:          The name of the server (i.e. which virtual host)
 %...{Foobar}i:  The contents of Foobar: header line(s) in the request
                 sent to the client.
 %...{Foobar}o:  The contents of Foobar: header line(s) in the reply.
+%...{Foobar}n:  The contents of note "Foobar" from another module
 
The `...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can @@ -54,38 +140,27 @@ requests which did not return some sort of normal status.

-The default LogFormat reproduces CLF; see below. - -

- -The way this is supposed to work with virtual hosts is as follows: -a virtual host can have its own LogFormat, or its own TransferLog. -If it doesn't have its own LogFormat, it inherits from the main -server. If it doesn't have its own TransferLog, it writes to the -same descriptor (meaning the same process for `| ...'). - -

+Note that the common log format is defined by the string "%h %l +%u %t \"%r\" %s %b", which can be used as the basis for +extending for format if desired (e.g. to add extra fields at the end). -That means that you can do things like: - -

-<VirtualHost hosta.com>
-LogFormat "hosta ..."
-...
-</VirtualHost>
-
-<VirtualHost hosta.com>
-LogFormat "hostb ..."
-...
-</VirtualHost>
- -... 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.

+

Using Multiple Log Files

+The TransferLog and CustomLog directives can +be given more than once to log requests to multiple log files. Each +request will be logged to all the log files defined by either of these +directives. +

Use with Virtual Hosts

+If a <VirtualHost> section does not contain any +TransferLog or CustomLog directives, the +logs defined for the main server will be used. If it does +contain one or more of these directives, requests serviced by +this virtual host will only be logged in the log files defined +within its definition, not in any of the main server's log files. +See the examples below. +

Directives

@@ -117,8 +192,8 @@ This sets the format of the logfile.


Status: Base
Module: mod_log_config

-The TransferLog directive sets the name of the file to which the server will -log the incoming requests. File-pipe is one +The TransferLog directive adds a log file in Common Log Format. +File-pipe is one of

A filename
A filename relative to the ServerRoot. @@ -137,8 +212,16 @@ was started by root; be sure that the program is secure.

Status: Base
Module: mod_log_config

-CustomLog combines TransferLog and LogFormat -- the format specified -to this directive is logged to the file or pipe specified.

+The first argument is the filename to log to. This is used +exactly like the argument to TransferLog, that is, +it is either a full path, or relative to the current +server root.

+ +The format argument specifies a format for each line of the log file. +The options available for the format are exactly the same as for +the argument of the LogFormat directive. If the format +includes any spaces (which it will do in almost all cases) it +should be enclosed in double quotes. -- 2.40.0