|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
vlink="#000080" alink="#FF0000">
Apache HTTP ServerMultiple Log FilesIt is now possible to specify multiple log files, each with a fully customizable format. This is compatible with existing configurations. Multiple log files are implemented as part of the mod_log_config module which as of Apache 1.2 is the default log module.Using Multiple Log FilesMultiple log files be created with either theTransferLog or CustomLog directive.
These directives can be repeated to create more than one log
file (in previous releases, only one logfile could be given per
server configuration). The TransferLog directive
creates a log file in the standard "common log format",
although this can be customized with LogFormat .
The syntax of these two directives is the same as for the
config log module in previous Apache releases.
The real power of multiple log files come from the ability to create log files in different formats. For example, as well as a CLF transfer log, the server could log the user agent of each client, or the referrer information, or any other aspect of the request, such as the language preferences of the user. The new Syntax: CustomLog filename "format" Context: server config, virtual host Status: base Module: mod_log_config The first argument is the filename to log to. This is used
exactly like the argument to 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 Use with Virtual HostsIf a <VirtualHost> section does not contain anyTransferLog 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.
ExamplesTo create a normal (CLF) format log file in logs/access_log, and a log of user agents:TransferLog logs/access_log CustomLog logs/agents "%{user-agent}i"To define a CLF transfer log and a referrer log which log all accesses to both the main server and a virtual host: TransferLog logs/access_log CustomLog logs/referer "%{referer}i" <VirtualHost> DocumentRoot /whatever ServerName my.virtual.host </VirtualHost>Since no TransferLog or CustomLog directives appear inside the <VirtualHost> section, any requests for this virtual host will be logged in the main server's log files. If however the directive TransferLog logs/vhost_access_logwas added inside the virtual host definition, then accesses to this virtual host will be logged in vhost_access_log file (in common log format), and not in logs/access_log or logs/referer. Apache HTTP Server |