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>
<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
-</div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>This section is experimental!</strong><br />Comments placed here should not be expected
-to last beyond the testing phase of this system, nor do we in any way guarantee that we'll read them.</div>
+</div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
<script type="text/javascript"><!--//--><![CDATA[//><!--
-var disqus_shortname = 'httpd';
-var disqus_identifier = 'http://httpd.apache.org/docs/2.4/logs.html.en';
+var comments_shortname = 'httpd';
+var comments_identifier = 'http://httpd.apache.org/docs/trunk/logs.html';
(function(w, d) {
- var disabled = true;
- if (w.location.hostname.toLowerCase() == "httpd.apache.org" && disabled !== true) {
- d.write('<div id="disqus_thread"><\/div>');
+ if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
+ d.write('<div id="comments_thread"><\/div>');
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
- s.src = 'http' + '://' + disqus_shortname + '.disqus.com/embed.js';
+ 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 {
- d.write('<div id="disqus_thread">Comments are disabled for this page at the moment.<\/div>');
+ d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
}
})(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();
}