📄 mod_log_config.html.en
字号:
not. This is configurable on a per-logfile basis.</li> <li>Beginning with Apache 1.3.5, the mod_log_config module has also subsumed the <code>RefererIgnore</code> functionality from <a href="mod_log_referer.html">mod_log_referer</a>. The effect of <code>RefererIgnore</code> can be achieved by combinations of <a href="mod_setenvif.html"><code>SetEnvIf</code></a> directives and conditional <code>CustomLog</code> definitions.</li> </ul> <hr /> <h2><a id="cookielog" name="cookielog">CookieLog</a> directive</h2> <p><a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> CookieLog <em>filename</em><br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> server config, virtual host<br /> <a href="directive-dict.html#Module" rel="Help"><strong>Module:</strong></a> mod_cookies<br /> <a href="directive-dict.html#Compatibility" rel="Help"><strong>Compatibility:</strong></a> Only available in Apache 1.2 and above</p> <p>The CookieLog directive sets the filename for logging of cookies. The filename is relative to the <a href="core.html#serverroot">ServerRoot</a>. This directive is included only for compatibility with <a href="mod_cookies.html">mod_cookies</a>, and is deprecated.</p> <hr /> <h2><a id="customlog" name="customlog">CustomLog</a> <a id="customlog-conditional" name="customlog-conditional">directive</a></h2> <p><a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> CustomLog <em>file</em>|<em>pipe</em> <em>format</em>|<em>nickname</em> [env=[!]<em>environment-variable</em>]<br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> server config, virtual host<br /> <a href="directive-dict.html#Status" rel="Help"><strong>Status:</strong></a> Base<br /> <a href="directive-dict.html#Compatibility" rel="Help"><strong>Compatibility:</strong></a> Nickname only available in Apache 1.3 or later. Conditional logging available in 1.3.5 or later.<br /> <a href="directive-dict.html#Module" rel="Help"><strong>Module:</strong></a> mod_log_config</p> <p>The <code>CustomLog</code> directive is used to log requests to the server. A log format is specified, and the logging can optionally be made conditional on request characteristics using environment variables.</p> <p>The first argument, which specifies the location to which the logs will be written, can take one of the following two types of values:</p> <dl> <dt><em>file</em></dt> <dd>A filename, relative to the <a href="core.html#serverroot">ServerRoot</a>.</dd> <dt><em>pipe</em></dt> <dd>The pipe character "<code>|</code>", followed by the path to a program to receive the log information on its standard input. <strong>Security:</strong> if a program is used, then it will be run as the user who started httpd. This will be root if the server was started by root; be sure that the program is secure.</dd> </dl> <p>The second argument specifies what will be written to the log file. It can specify either a <em>nickname</em> defined by a previous <a href="#logformat">LogFormat</a> directive, or it can be an explicit <em>format</em> string as described in the <a href="#formats">log formats</a> section.</p> <p>For example, the following two sets of directives have exactly the same effect:</p><pre> # CustomLog with format nickname LogFormat "%h %l %u %t \"%r\" %>s %b" common CustomLog logs/access_log common # CustomLog with explicit format string CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"</pre> <p>The third argument is optional and controls whether or not to log a particular request based on the presence or absence of a particular variable in the server environment. If the specified <a href="../env.html">environment variable</a> is set for the request (or is not set, in the case of a '<code>env=!<em>name</em></code>' clause), then the request will be logged.</p> <p>Environment variables can be set on a per-request basis using the <a href="mod_setenvif.html">mod_setenvif</a> and/or <a href="mod_rewrite.html">mod_rewrite</a> modules. For example, if you want to record requests for all GIF images on your server in a separate logfile but not in your main log, you can use:</p><pre> SetEnvIf Request_URI \.gif$ gif-image CustomLog gif-requests.log common env=gif-image CustomLog nongif-requests.log common env=!gif-image</pre> <hr /> <h2><a id="logformat" name="logformat">LogFormat</a> directive</h2> <p><a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> LogFormat <em>format</em>|<em>nickname</em> [<em>nickname</em>]<br /> <a href="directive-dict.html#Default" rel="Help"><strong>Default:</strong></a> <code>LogFormat "%h %l %u %t \"%r\" %>s %b"</code><br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> server config, virtual host<br /> <a href="directive-dict.html#Status" rel="Help"><strong>Status:</strong></a> Base<br /> <a href="directive-dict.html#Compatibility" rel="Help"><strong>Compatibility:</strong></a> Nickname only available in Apache 1.3 or later<br /> <a href="directive-dict.html#Module" rel="Help"><strong>Module:</strong></a> mod_log_config</p> <p>This directive specifies the format of the access log file.</p> <p>The <code>LogFormat</code> directive can take one of two forms. In the first form, where only one argument is specified, this directive sets the log format which will be used by logs specified in subsequent <a href="#transferlog">TransferLog</a> directives. The single argument can specify an explicit <em>format</em> as discussed in the <a href="#formats">custom log formats</a> section above. Alternatively, it can use a <em>nickname</em> to refer to a log format defined in a previous <code>LogFormat</code> directive as described below.</p> <p>The second form of the <code>LogFormat</code> directive associates an explicit <em>format</em> with a <em>nickname</em>. This <em>nickname</em> can then be used in subsequent <code>LogFormat</code> or <a href="#customlog">CustomLog</a> directives rather than repeating the entire format string. A <samp>LogFormat</samp> directive which defines a nickname <strong>does nothing else</strong> -- that is, it <em>only</em> defines the nickname, it doesn't actually apply the format and make it the default. Therefore, it will not affect subsequent <a href="#transferlog">TransferLog</a> directives.</p> <p>For example:</p> <code>LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common</code> <hr /> <h2><a id="transferlog" name="transferlog">TransferLog</a> directive</h2> <p><a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> TransferLog <em>file</em>|<em>pipe</em><br /> <a href="directive-dict.html#Default" rel="Help"><strong>Default:</strong></a> none<br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> server config, virtual host<br /> <a href="directive-dict.html#Status" rel="Help"><strong>Status:</strong></a> Base<br /> <a href="directive-dict.html#Module" rel="Help"><strong>Module:</strong></a> mod_log_config</p> <p>This directive has exactly the same arguments and effect as the <a href="#customlog">CustomLog</a> directive, with the exception that it does not allow the log format to be specified explicitly or for conditional logging of requests. Instead, the log format is determined by the most recently specified <a href="#logformat">LogFormat</a> directive that does not define a nickname. Common Log Format is used if no other format has been specified.</p> <p>Example:</p><pre> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" TransferLog logs/access_log</pre> <hr /> <h3 align="CENTER">Apache HTTP Server Version 1.3</h3> <a href="./"><img src="../images/index.gif" alt="Index" /></a> <a href="../"><img src="../images/home.gif" alt="Home" /></a> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -