This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
-<title>Log Files - Apache HTTP Server</title>
+<title>Log Files - Apache HTTP Server Version 2.5</title>
<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" />
-<script src="./style/scripts/prettify.js" type="text/javascript">
+<script src="./style/scripts/prettify.min.js" type="text/javascript">
</script>
<link href="./images/favicon.ico" rel="shortcut icon" /></head>
<body id="manual-page"><div id="page-header">
-<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p>
+<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p>
<p class="apache">Apache HTTP Server Version 2.5</p>
<img alt="" src="./images/feather.gif" /></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div>
<p>Do this by specifying the name of the module in your
<code class="directive">LogLevel</code> directive:</p>
- <pre class="prettyprint lang-config">
- LogLevel info rewrite:trace5
- </pre>
+ <pre class="prettyprint lang-config">LogLevel info rewrite:trace5</pre>
<p>This sets the main <code class="directive">LogLevel</code> to info, but
<p>A typical configuration for the access log might look as
follows.</p>
- <pre class="prettyprint lang-config">
-LogFormat "%h %l %u %t \"%r\" %>s %b" common
-CustomLog logs/access_log common
- </pre>
+ <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b" common
+CustomLog logs/access_log common</pre>
<p>This defines the <em>nickname</em> <code>common</code> and
<p>Another commonly used format string is called the Combined
Log Format. It can be used as follows.</p>
- <pre class="prettyprint lang-config">
-LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
-CustomLog log/access_log combined
- </pre>
+ <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
+CustomLog log/access_log combined</pre>
<p>This format is exactly the same as the Common Log Format,
information. The last two <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> lines show how
to mimic the effects of the <code>ReferLog</code> and <code>AgentLog</code> directives.</p>
- <pre class="prettyprint lang-config">
-LogFormat "%h %l %u %t \"%r\" %>s %b" common
+ <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
CustomLog logs/referer_log "%{Referer}i -> %U"
-CustomLog logs/agent_log "%{User-agent}i"
- </pre>
+CustomLog logs/agent_log "%{User-agent}i"</pre>
<p>This example also shows that it is not necessary to define a
include or exclude requests where the environment variable is
set. Some examples:</p>
- <pre class="prettyprint lang-config">
-# Mark requests from the loop-back interface
+ <pre class="prettyprint lang-config"># Mark requests from the loop-back interface
SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
# Mark requests for the robots.txt file
SetEnvIf Request_URI "^/robots\.txt$" dontlog
# Log what remains
-CustomLog logs/access_log common env=!dontlog
- </pre>
+CustomLog logs/access_log common env=!dontlog</pre>
<p>As another example, consider logging requests from
english-speakers to one log file, and non-english speakers to a
different log file.</p>
- <pre class="prettyprint lang-config">
- SetEnvIf Accept-Language "en" english<br />
+ <pre class="prettyprint lang-config"> SetEnvIf Accept-Language "en" english<br />
CustomLog logs/english_log common env=english<br />
- CustomLog logs/non_english_log common env=!english
- </pre>
+ CustomLog logs/non_english_log common env=!english</pre>
<p>In a caching scenario one would want to know about
the efficiency of the cache. A very simple method to
find this out would be:</p>
- <pre class="prettyprint lang-config">
-SetEnv CACHE_MISS 1
+ <pre class="prettyprint lang-config">SetEnv CACHE_MISS 1
LogFormat "%h %l %u %t "%r " %>s %b %{CACHE_MISS}e" common-cache
-CustomLog logs/access_log common-cache
- </pre>
+CustomLog logs/access_log common-cache</pre>
<p><code class="module"><a href="./mod/mod_cache.html">mod_cache</a></code> will run before
- <code class="module"><a href="./mod/mod_env.html">mod_env</a></code> and when successfull will deliver the
+ <code class="module"><a href="./mod/mod_env.html">mod_env</a></code> and, when successful, will deliver the
content without it. In that case a cache hit will log
<code>-</code>, while a cache miss will log <code>1</code>.</p>
<p>In addition to the <code>env=</code> syntax, <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> supports logging values
conditional upon the HTTP response code:</p>
- <pre class="prettyprint lang-config">
-LogFormat "%400,501{User-agent}i" browserlog
-LogFormat "%!200,304,302{Referer}i" refererlog
- </pre>
+ <pre class="prettyprint lang-config">LogFormat "%400,501{User-agent}i" browserlog
+LogFormat "%!200,304,302{Referer}i" refererlog</pre>
<p>In the first example, the <code>User-agent</code> will be
for this purpose. For example, to rotate the logs every 24 hours, you
can use:</p>
- <pre class="prettyprint lang-config">
- CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common
- </pre>
+ <pre class="prettyprint lang-config">CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common</pre>
<p>Notice that quotes are used to enclose the entire command
a shell. Use "<code>|$</code>" instead of "<code>|</code>"
to spawn using a shell (usually with <code>/bin/sh -c</code>):</p>
- <pre class="prettyprint lang-config">
-# Invoke "rotatelogs" using a shell
-CustomLog "|$/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common
- </pre>
+ <pre class="prettyprint lang-config"># Invoke "rotatelogs" using a shell
+CustomLog "|$/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common</pre>
<p>This was the default behaviour for Apache 2.2.
later split the log into individual files. For example,
consider the following directives.</p>
- <pre class="prettyprint lang-config">
-LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
-CustomLog logs/access_log comonvhost
- </pre>
+ <pre class="prettyprint lang-config">LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
+CustomLog logs/access_log comonvhost</pre>
<p>The <code>%v</code> is used to log the name of the virtual
- host that is serving the request. Then a program like <a href="programs/other.html">split-logfile</a> can be used to
+ host that is serving the request. Then a program like <a href="programs/split-logfile.html">split-logfile</a> can be used to
post-process the access log in order to split it into one file
per virtual host.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
- s.src = 'https://c.apaste.info/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
+ s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
}
else {
}
})(window, document);
//--><!]]></script></div><div id="footer">
-<p class="apache">Copyright 2012 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
-<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
+<p class="apache">Copyright 2014 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
+<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}