From: Ken Coar Date: Wed, 17 Feb 1999 23:28:11 +0000 (+0000) Subject: Add conditional logging based upon environment variable existence. X-Git-Tag: 1.3.5~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67c4a600f1bc53e5a67564d403b0a808c56f65b4;p=apache Add conditional logging based upon environment variable existence. Also add RefererIgnore functionality from mod_log_referer to mod_log_config; mod_log_referer and mod_log_agent are now deprecated. The list of envariables to check is set up as an array even though the current implementation (TAKE23) only handles one; just in case we ever want to do something strange like, 'env=foo,bar,!bag'. PR: 519, 548, 1351, 1811(?), 3449 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@82819 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_log_config.html b/docs/manual/mod/mod_log_config.html index 246899c291..1d1c0171e7 100644 --- a/docs/manual/mod/mod_log_config.html +++ b/docs/manual/mod/mod_log_config.html @@ -14,22 +14,23 @@ >

Module mod_log_config

- +

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 the Common Log Format or a user-specified format. +

Summary

- +

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 used multiple times in each server to cause each request to be logged to multiple files. -

+

Compatibility notes

@@ -45,6 +46,22 @@ HREF="mod_usertrack.html">mod_usertrack. The use of CookieLog is deprecated, and a CustomLog should be defined to log user-tracking information instead. +
  • As of Apache 1.3.5, this module allows conditional logging +based upon the setting of environment variables. That is, +you can control whether a request should be logged or not +based upon whether an arbitrary environment variable is +defined or not. This is settable on a per-logfile +basis. + +
  • Beginning with Apache 1.3.5, the mod_log_config module has +also subsumed the RefererIgnore directive from +mod_log_referer. The use +of RefererIgnore is deprecated, and should be +replaced by combinations of +SetEnvIf directives +and environment variable controlled CustomLog +definitions. +

    Log File Formats

    @@ -195,7 +212,9 @@ the user that starts the server.
    @@ -223,8 +242,8 @@ the user that starts the server. The CookieLog directive sets the filename for logging of cookies. The filename is relative to the ServerRoot. This directive is included -only for compatibility with mod_cookies, and is deprecated. +only for compatibility with +mod_cookies, and is deprecated.


    @@ -242,7 +261,10 @@ HREF="mod_cookies.html">mod_cookies, and is deprecated. HREF="directive-dict.html#Status" REL="Help" >Status: Base
    -Compatibility: Nickname only available in Apache 1.3 +Compatibility: Nickname only available in Apache 1.3 or later
    LogFormat directive.

    + +
    +

    CustomLog (conditional)

    +Syntax: CustomLog file-pipe + format-or-nickname + env=[!]environment-variable
    +Context: server config, virtual host
    +Status: Base
    +Compatibility: Only available in Apache 1.3.5 + or later +
    +Module: mod_log_config +

    + +The behaviour of this form of the CustomLog directive is almost +identical to the standard CustomLog +directive. The difference is that the 'env=' clause controls +whether a particular request will be logged in the specified file or +not. If the specified environment variable is set for the +request (or is not set, in the case of a 'env=!name' +clause), then the request will be logged. +

    +

    +Environment variables can be set on a per-request basis +using the mod_setenvif and/or +mod_rewrite modules. For example, +if you don't want to record requests for all GIF images on +your server in a separate logfile but not your main log, you +can use: +

    +
    +    SetEnvIf Request_URI \.gif$ gif-image
    +    CustomLog gif-requests.log common env=gif-image
    +    CustomLog nongif-requests.log common env=!gif-image
    +
    +

    LogFormat

    @@ -295,7 +368,10 @@ directive. HREF="directive-dict.html#Status" REL="Help" >Status: Base
    -Compatibility: Nickname only available in Apache 1.3 +Compatibility: Nickname only available in Apache 1.3 or later
    If you include a nickname for the format on the directive line, you can use it in other LogFormat and -CustomLog +CustomLog directives rather than repeating the entire format string.

    @@ -327,6 +401,55 @@ it doesn't actually apply the format and make it the default.


    +

    RefererIgnore

    +Syntax: RefererIgnore string string ...
    +Context: server config, virtual host
    +Status: Base
    +Compatibility:> Only available in Apache 1.3.5 + or later +
    +Module: mod_log_config + +

    +The RefererIgnore directive adds to the list of strings to ignore in +Referer headers. If any of the strings in the list is contained in +the Referer header, then no referrer information will be logged for the +request. Example: +

    +
    +    RefererIgnore www.ncsa.uiuc.edu
    +
    +

    +will avoid logging references from www.ncsa.uiuc.edu. +

    +

    +Note: All transaction logfiles +(defined by CustomLog or TransferLog) in +the same server scope as the RefererIgnore (e.g., +in the same <VirtualHost> container) +are affected by +this directive. If you want to control this behaviour on a +per-logfile basis, you should use the +conditional CustomLog +capability. +

    +
    +

    TransferLog