]> granicus.if.org Git - apache/blob - docs/manual/logs.html.en
a0f71fcc1cc4e65055ddd6ea6b2589945b5cba8e
[apache] / docs / manual / logs.html.en
1 <html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
2         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3               This file is generated from xml source: DO NOT EDIT
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5       --><title>Log Files - Apache HTTP Server</title><link href="./style/manual.css" type="text/css" rel="stylesheet"/></head><body><blockquote><div align="center"><img src="./images/sub.gif" alt="[APACHE DOCUMENTATION]"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Log Files</h1>
6     <p>In order to effectively manage a web server, it is necessary
7     to get feedback about the activity and performance of the
8     server as well as any problems that may be occuring. The Apache
9     HTTP Server provides very comprehensive and flexible logging
10     capabilities. This document describes how to configure its
11     logging capabilities, and how to understand what the logs
12     contain.</p>
13   <ul><li><a href="#security">Security Warning</a></li><li><a href="#errorlog">Error Log</a></li><li><a href="#accesslog">Access Log</a><ul><li><a href="#common">Common Log Format</a></li><li><a href="#combined">Combined Log Format</a></li><li><a href="#multiple">Multiple Access Logs</a></li><li><a href="#conditional">Conditional Logs</a></li></ul></li><li><a href="#rotation">Rotation Logs</a></li><li><a href="#piped">Piped Logs</a></li><li><a href="#virtualhost">Virtual Hosts</a></li><li><a href="#other">Other Log Files</a><ul><li><a href="#pidfile">PID File</a></li><li><a href="#scriptlog">Script Log</a></li><li><a href="#rewritelog">Rewrite Log</a></li></ul></li></ul><hr/><h2><a name="security">Security Warning</a></h2>
14     
15     
16     <p>Anyone who can write to the directory where Apache is
17     writing a log file can almost certainly gain access to the uid
18     that the server is started as, which is normally root. Do
19     <em>NOT</em> give people write access to the directory the logs
20     are stored in without being aware of the consequences; see the
21     <a href="misc/security_tips.html">security tips</a> document
22     for details.</p>
23
24     <p>In addition, log files may contain information supplied
25     directly by the client, without escaping. Therefore, it is
26     possible for malicious clients to insert control-characters in
27     the log files, so care must be taken in dealing with raw
28     logs.</p>
29   <h2><a name="errorlog">Error Log</a></h2>
30     
31     
32     <table border="1"><tr><td valign="top"><strong>Related Modules</strong><br/><br/></td><td valign="top"><strong>Related Directives</strong><br/><br/><a href="./mod/mod_core.html#errorlog" class="directive"><code class="directive">ErrorLog</code></a><br/><a href="./mod/mod_core.html#loglevel" class="directive"><code class="directive">LogLevel</code></a><br/></td></tr></table>
33     
34     <p>The server error log, whose name and location is set by the
35     <a href="./mod/core.html#errorlog" class="directive"><code class="directive">ErrorLog</code></a> directive, is the
36     most important log file. This is the place where Apache httpd
37     will send diagnostic information and record any errors that it
38     encounters in processing requests. It is the first place to
39     look when a problem occurs with starting the server or with the
40     operation of the server, since it will often contain details of
41     what went wrong and how to fix it.</p>
42
43     <p>The error log is usually written to a file (typically
44     <code>error_log</code> on unix systems and
45     <code>error.log</code> on Windows and OS/2). On unix systems it
46     is also possible to have the server send errors to
47     <code>syslog</code> or <a href="#piped">pipe them to a
48     program</a>.</p>
49     
50     <p>The format of the error log is relatively free-form and
51     descriptive. But there is certain information that is contained
52     in most error log entries. For example, here is a typical
53     message.</p>
54     
55     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
56       [Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1]
57       client denied by server configuration:
58       /export/home/live/ap/htdocs/test
59     </code></td></tr></table></blockquote>
60     
61     <p>The first item in the log entry is the date and time of the
62     message. The second entry lists the severity of the error being
63     reported. The <a href="./mod/core.html#loglevel" class="directive"><code class="directive">LogLevel</code></a>
64     directive is used to control the types of errors that are sent
65     to the error log by restricting the severity level. The third
66     entry gives the IP address of the client that generated the
67     error. Beyond that is the message itself, which in this case
68     indicates that the server has been configured to deny the
69     client access. The server reports the file-system path (as
70     opposed to the web path) of the requested document.</p>
71
72     <p>A very wide variety of different messages can appear in the
73     error log. Most look similar to the example above. The error
74     log will also contain debugging output from CGI scripts. Any
75     information written to <code>stderr</code> by a CGI script will
76     be copied directly to the error log.</p>
77
78     <p>It is not possible to customize the error log by adding or
79     removing information. However, error log entries dealing with
80     particular requests have corresponding entries in the <a href="#accesslog">access log</a>. For example, the above example
81     entry corresponds to an access log entry with status code 403.
82     Since it is possible to customize the access log, you can
83     obtain more information about error conditions using that log
84     file.</p>
85     
86     <p>During testing, it is often useful to continuously monitor
87     the error log for any problems. On unix systems, you can
88     accomplish this using:</p>
89     
90     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
91       tail -f error_log
92     </code></td></tr></table></blockquote>
93   <h2><a name="accesslog">Access Log</a></h2>
94     
95     
96     <table border="1"><tr><td valign="top"><strong>Related Modules</strong><br/><br/><code><a href="./mod/mod_log_config.html">mod_log_config</a></code><br/><code><a href="./mod/mod_setenvif.html">mod_setenvif</a></code><br/></td><td valign="top"><strong>Related Directives</strong><br/><br/><a href="./mod/mod_log_config.html#customlog" class="directive"><code class="directive">CustomLog</code></a><br/><a href="./mod/mod_log_config.html#logformat" class="directive"><code class="directive">LogFormat</code></a><br/><a href="./mod/mod_setenvif.html#setenvif" class="directive"><code class="directive">SetEnvIf</code></a><br/></td></tr></table>
97     
98     <p>The server access log records all requests processed by the
99     server. The location and content of the access log are
100     controlled by the <a href="./mod/mod_log_config.html#
101     customlog" class="directive"><code class="directive">
102     CustomLog</code></a> directive. The <a href="./mod/mod_log_config.html#
103     logformat" class="directive"><code class="directive">
104     LogFormat</code></a> directive can be used to simplify the selection of 
105     the contents of the logs. This section describes how to configure the server
106     to record information in the access log.</p>
107
108     <p>Of course, storing the information in the access log is only
109     the start of log management. The next step is to analyze this
110     information to produce useful statistics. Log analysis in
111     general is beyond the scope of this document, and not really
112     part of the job of the web server itself. For more information
113     about this topic, and for applications which perform log
114     analysis, check the <a href="http://dmoz.org/Computers/Software/Internet/Site_Management/Log_analysis/">
115     Open Directory</a> or <a href="http://dir.yahoo.com/Computers_and_Internet/Software/Internet/World_Wide_Web/Servers/Log_Analysis_Tools/">
116     Yahoo</a>.</p>
117     
118     <p>Various versions of Apache httpd have used other modules and
119     directives to control access logging, including
120     mod_log_referer, mod_log_agent, and the
121     <code>TransferLog</code> directive. The <code>CustomLog</code>
122     directive now subsumes the functionality of all the older
123     directives.</p>
124
125     <p>The format of the access log is highly configurable. The
126     format is specified using a <a href="./mod/mod_log_config.html#
127     customlog" class="directive"><code class="directive">
128     CustomLog</code></a> that
129     looks much like a C-style printf(1) format string. Some
130     examples are presented in the next sections. For a complete
131     list of the possible contents of the format string, see the <a href="mod/mod_log_config.html">mod_log_config
132     documentation</a>.</p>
133     
134     <h3><a name="common">Common Log Format</a></h3>
135       
136     
137       <p>A typical configuration for the access log might look as
138       follows.</p>
139
140       <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
141         LogFormat "%h %l %u %t \"%r\" %&gt;s %b" common<br>
142          CustomLog logs/access_log common
143       </code></td></tr></table></blockquote>
144     
145       <p>This defines the <em>nickname</em> <code>common</code> and
146       associates it with a particular log format string. The format
147       string consists of percent directives, each of which tell the
148       server to log a particular piece of information. Literal
149       characters may also be placed in the format string and will be
150       copied directly into the log output. The quote character
151       (<code>"</code>) must be escaped by placing a back-slash before
152       it to prevent it from being interpreted as the end of the
153       format string. The format string may also contain the special
154       control characters "<code>\n</code>" for new-line and
155       "<code>\t</code>" for tab.</p>
156
157       <p>The <code>CustomLog</code> directive sets up a new log file
158       using the defined <em>nickname</em>. The filename for the
159       access log is relative to the <a href="./mod/core.html#
160       serverroot" class="directive"><code class="directive">
161       ServerRoot</code></a> unless it begins
162       with a slash.</p>
163     
164       <p>The above configuration will write log entries in a format
165       known as the Common Log Format (CLF). This standard format can
166       be produced by many different web servers and read by many log
167       analysis programs. The log file entries produced in CLF will
168       look something like this:</p>
169
170       <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
171         127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET
172         /apache_pb.gif HTTP/1.0" 200 2326
173       </code></td></tr></table></blockquote>
174     
175       <p>Each part of this log entry is described below.</p>
176     
177       <dl>
178         <dt><code>127.0.0.1</code> (<code>%h</code>)</dt>
179
180         <dd>This is the IP address of the client (remote host) which
181         made the request to the server. If <a href="./mod/core.html#
182         hostnamelookups" class="directive"><code class="directive">
183         HostnameLookups</code></a> is
184         set to <code>On</code>, then the server will try to determine
185         the hostname and log it in place of the IP address. However,
186         this configuration is not recommended since it can
187         significantly slow the server. Instead, it is best to use a
188         log post-processor such as <a href="programs/logresolve.html">logresolve</a> to determine
189         the hostnames. The IP address reported here is not
190         necessarily the address of the machine at which the user is
191         sitting. If a proxy server exists between the user and the
192         server, this address will be the address of the proxy, rather
193         than the originating machine.</dd>
194
195         <dt><code>-</code> (<code>%l</code>)</dt>
196
197         <dd>The "hyphen" in the output indicates that the requested
198         piece of information is not available. In this case, the
199         information that is not available is the RFC 1413 identity of
200         the client determined by <code>identd</code> on the clients
201         machine. This information is highly unreliable and should
202         almost never be used except on tightly controlled internal
203         networks. Apache httpd will not even attempt to determine
204         this information unless <a href="./mod/core.html#
205         identitycheck" class="directive"><code class="directive">
206         IdentityCheck</code></a> is set
207         to <code>On</code>.</dd>
208
209         <dt><code>frank</code> (<code>%u</code>)</dt>
210
211         <dd>This is the userid of the person requesting the document
212         as determined by HTTP authentication. The same value is
213         typically provided to CGI scripts in the
214         <code>REMOTE_USER</code> environment variable. If the status
215         code for the request (see below) is 401, then this value
216         should not be trusted because the user is not yet
217         authenticated. If the document is not password protected,
218         this entry will be "<code>-</code>" just like the previous
219         one.</dd>
220
221         <dt><code>[10/Oct/2000:13:55:36 -0700]</code>
222         (<code>%t</code>)</dt>
223
224         <dd>
225           The time that the server finished processing the request.
226           The format is: 
227
228           <blockquote>
229             <code>[day/month/year:hour:minute:second zone]<br>
230              day = 2*digit<br>
231              month = 3*letter<br>
232              year = 4*digit<br>
233              hour = 2*digit<br>
234              minute = 2*digit<br>
235              second = 2*digit<br>
236              zone = (`+' | `-') 4*digit</code>
237           </blockquote>
238           It is possible to have the time displayed in another format
239           by specifying <code>%{format}t</code> in the log format
240           string, where <code>format</code> is as in
241           <code>strftime(3)</code> from the C standard library.
242         </dd>
243
244         <dt><code>"GET /apache_pb.gif HTTP/1.0"</code>
245         (<code>\"%r\"</code>)</dt>
246
247         <dd>The request line from the client is given in double
248         quotes. The request line contains a great deal of useful
249         information. First, the method used by the client is
250         <code>GET</code>. Second, the client requested the resource
251         <code>/apache_pb.gif</code>, and third, the client used the
252         protocol <code>HTTP/1.0</code>. It is also possible to log
253         one or more parts of the request line independently. For
254         example, the format string "<code>%m %U%q %H</code>" will log
255         the method, path, query-string, and protocol, resulting in
256         exactly the same output as "<code>%r</code>".</dd>
257
258         <dt><code>200</code> (<code>%&gt;s</code>)</dt>
259
260         <dd>This is the status code that the server sends back to the
261         client. This information is very valuable, because it reveals
262         whether the request resulted in a successful response (codes
263         beginning in 2), a redirection (codes beginning in 3), an
264         error caused by the client (codes beginning in 4), or an
265         error in the server (codes beginning in 5). The full list of
266         possible status codes can be found in the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.txt">HTTP
267         specification</a> (RFC2616 section 10).</dd>
268
269         <dt><code>2326</code> (<code>%b</code>)</dt>
270
271         <dd>The last entry indicates the size of the object returned
272         to the client, not including the response headers. If no
273         content was returned to the client, this value will be
274         "<code>-</code>". To log "<code>0</code>" for no content, use
275         <code>%B</code> instead.</dd>
276       </dl>
277     
278     
279     <h3><a name="combined">Combined Log Format</a></h3>
280       
281       
282       <p>Another commonly used format string is called the Combined
283       Log Format. It can be used as follows.</p>
284
285       <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
286         LogFormat "%h %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\"
287         \"%{User-agent}i\"" combined<br>
288          CustomLog log/acces_log combined
289       </code></td></tr></table></blockquote>
290
291       <p>This format is exactly the same as the Common Log Format,
292       with the addition of two more fields. Each of the additional
293       fields uses the percent-directive
294       <code>%{<em>header</em>}i</code>, where <em>header</em> can be
295       any HTTP request header. The access log under this format will
296       look like:</p>
297       
298       <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
299         127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET
300         /apache_pb.gif HTTP/1.0" 200 2326
301         "http://www.example.com/start.html" "Mozilla/4.08 [en]
302         (Win98; I ;Nav)"
303       </code></td></tr></table></blockquote>
304
305       <p>The additional fields are:</p>
306       
307       <dl>
308         <dt><code>"http://www.example.com/start.html"</code>
309         (<code>\"%{Referer}i\"</code>)</dt>
310
311         <dd>The "Referer" (sic) HTTP request header. This gives the
312         site that the client reports having been referred from. (This
313         should be the page that links to or includes
314         <code>/apache_pb.gif</code>).</dd>
315
316         <dt><code>"Mozilla/4.08 [en] (Win98; I ;Nav)"</code>
317         (<code>\"%{User-agent}i\"</code>)</dt>
318
319         <dd>The User-Agent HTTP request header. This is the
320         identifying information that the client browser reports about
321         itself.</dd>
322       </dl>
323     
324     
325     <h3><a name="multiple">Multiple Access Logs</a></h3>
326       
327       
328       <p>Multiple access logs can be created simply by specifying
329       multiple <a href="./mod/core.html#customlog" class="directive"><code class="directive">CustomLog</code></a> 
330       directives in the configuration
331       file. For example, the following directives will create three
332       access logs. The first contains the basic CLF information,
333       while the second and third contain referer and browser
334       information. The last two <a href="./mod/core.html#
335       customlog" class="directive"><code class="directive">
336       CustomLog</code></a> lines show how
337       to mimic the effects of the <a href="./mod/core.html#referlog" class="directive"><code class="directive">ReferLog</code></a> 
338       and <a href="./mod/core.html#agentlog" class="directive"><code class="directive">AgentLog</code></a> directives.</p>
339
340       <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
341         LogFormat "%h %l %u %t \"%r\" %&gt;s %b" common<br>
342         CustomLog logs/access_log common<br>
343         CustomLog logs/referer_log "%{Referer}i -&gt; %U"<br>
344         CustomLog logs/agent_log "%{User-agent}i"
345       </code></td></tr></table></blockquote>
346
347       <p>This example also shows that it is not necessary to define a
348       nickname with the <code>LogFormat</code> directive. Instead,
349       the log format can be specified directly in the 
350       <a href="./mod/core.html#customlog" class="directive"><code class="directive">CustomLog</code></a> directive.</p>
351     
352     
353     <h3><a name="conditional">Conditional Logs</a></h3>
354       
355       
356       <p>There are times when it is convenient to exclude certain
357       entries from the access logs based on characteristics of the
358       client request. This is easily accomplished with the help of <a href="env.html">environment variables</a>. First, an
359       environment variable must be set to indicate that the request
360       meets certain conditions. This is usually accomplished with 
361       <a href="./mod/mod_setenvif.html#setenvif" class="directive"><code class="directive">SetEnvIf</code></a>. Then the
362       <code>env=</code> clause of the <code>CustomLog</code>
363       directive is used to include or exclude requests where the
364       environment variable is set. Some examples:</p>
365
366       <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
367         # Mark requests from the loop-back interface<br>
368         SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog<br>
369         # Mark requests for the robots.txt file<br>
370         SetEnvIf Request_URI "^/robots\.txt$" dontlog<br>
371         # Log what remains<br>
372         CustomLog logs/access_log common env=!dontlog
373       </code></td></tr></table></blockquote>
374
375       <p>As another example, consider logging requests from
376       english-speakers to one log file, and non-english speakers to a
377       different log file.</p>
378
379       <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
380         SetEnvIf Accept-Language "en" english<br>
381         CustomLog logs/english_log common env=english<br>
382         CustomLog logs/non_english_log common env=!english
383       </code></td></tr></table></blockquote>
384
385       <p>Although we have just shown that conditional logging is very
386       powerful and flexibly, it is not the only way to control the
387       contents of the logs. Log files are more useful when they
388       contain a complete record of server activity. It is often
389       easier to simply post-process the log files to remove requests
390       that you do not want to consider.</p>
391     
392   <h2><a name="rotation">Rotation Logs</a></h2>
393     
394     
395     <p>On even a moderately busy server, the quantity of
396     information stored in the log files is very large. The access
397     log file typically grows 1 MB or more per 10,000 requests. It
398     will consequently be necessary to periodically rotate the log
399     files by moving or deleting the existing logs. This cannot be
400     done while the server is running, because Apache will continue
401     writing to the old log file as long as it holds the file open.
402     Instead, the server must be <a href="stopping.html">restarted</a> after the log files are
403     moved or deleted so that it will open new log files.</p>
404
405     <p>By using a <em>graceful</em> restart, the server can be
406     instructed to open new log files without losing any existing or
407     pending connections from clients. However, in order to
408     accomplish this, the server must continue to write to the old
409     log files while it finishes serving old requests. It is
410     therefore necessary to wait for some time after the restart
411     before doing any processing on the log files. A typical
412     scenario that simply rotates the logs and compresses the old
413     logs to save space is:</p>
414
415     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
416       mv access_log access_log.old<br>
417       mv error_log error_log.old<br>
418       apachectl graceful<br>
419       sleep 600<br>
420       gzip access_log.old error_log.old
421     </code></td></tr></table></blockquote>
422
423     <p>Another way to perform log rotation is using <a href="#piped">piped logs</a> as discussed in the next
424     section.</p>
425   <h2><a name="piped">Piped Logs</a></h2>
426     
427     
428     <p>Apache httpd is capable of writing error and access log
429     files through a pipe to another process, rather than directly
430     to a file. This capability dramatically increases the
431     flexibility of logging, without adding code to the main server.
432     In order to write logs to a pipe, simply replace the filename
433     with the pipe character "<code>|</code>", followed by the name
434     of the executable which should accept log entries on its
435     standard input. Apache will start the piped-log process when
436     the server starts, and will restart it if it crashes while the
437     server is running. (This last feature is why we can refer to
438     this technique as "reliable piped logging".)</p>
439
440     <p>Piped log processes are spawned by the parent Apache httpd
441     process, and inherit the userid of that process. This means
442     that piped log programs usually run as root. It is therefore
443     very important to keep the programs simple and secure.</p>
444
445     <p>Some simple examples using piped logs:</p>
446
447     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
448       # compressed logs<br>
449       CustomLog "|/usr/bin/gzip -c &gt;&gt;
450       /var/log/access_log.gz" common<br>
451       # almost-real-time name resolution<br>
452       CustomLog "|/usr/local/apache/bin/logresolve &gt;&gt;
453       /var/log/access_log" common
454     </code></td></tr></table></blockquote>
455
456     <p>Notice that quotes are used to enclose the entire command
457     that will be called for the pipe. Although these examples are
458     for the access log, the same technique can be used for the
459     error log.</p>
460
461     <p>One important use of piped logs is to allow log rotation
462     without having to restart the server. The Apache HTTP Server
463     includes a simple program called <a href="programs/rotatelogs.html">rotatelogs</a> for this
464     purpose. For example, to rotate the logs every 24 hours, you
465     can use:</p>
466
467     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
468       CustomLog "|/usr/local/apache/bin/rotatelogs
469       /var/log/access_log 86400" common
470     </code></td></tr></table></blockquote>
471     
472     <p>A similar, but much more flexible log rotation program
473     called <a href="http://www.cronolog.org/">cronolog</a>
474     is available at an external site.</p>
475
476     <p>As with conditional logging, piped logs are a very powerful
477     tool, but they should not be used where a simpler solution like
478     off-line post-processing is available.</p>
479   <h2><a name="virtualhost">Virtual Hosts</a></h2>
480     
481     
482     <p>When running a server with many <a href="vhosts/">virtual
483     hosts</a>, there are several options for dealing with log
484     files. First, it is possible to use logs exactly as in a
485     single-host server. Simply by placing the logging directives
486     outside the <code>&lt;VirtualHost&gt;</code> sections in the
487     main server context, it is possible to log all requests in the
488     same access log and error log. This technique does not allow
489     for easy collection of statistics on individual virtual
490     hosts.</p>
491
492     <p>If <a href="./mod/mod_log_config.html#customlog" class="directive"><code class="directive">CustomLog</code></a> 
493     or <a href="./mod/mod_log_config.html#errorlog" class="directive"><code class="directive">ErrorLog</code></a>
494     directives are placed inside a <a href="./mod/core.html#
495     <virtualhost>" class="directive"><code class="directive">
496     &lt;VirtualHost&gt;</code></a>
497     section, all requests or errors for that virtual host will be
498     logged only to the specified file. Any virtual host which does
499     not have logging directives will still have its requests sent
500     to the main server logs. This technique is very useful for a
501     small number of virtual hosts, but if the number of hosts is
502     very large, it can be complicated to manage. In addition, it
503     can often create problems with <a href="vhosts/fd-limits.html">insufficient file
504     descriptors</a>.</p>
505
506     <p>For the access log, there is a very good compromise. By
507     adding information on the virtual host to the log format
508     string, it is possible to log all hosts to the same log, and
509     later split the log into individual files. For example,
510     consider the following directives.</p>
511
512     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
513       LogFormat "%v %l %u %t \"%r\" %&gt;s %b"
514       comonvhost<br>
515       CustomLog logs/access_log comonvhost
516     </code></td></tr></table></blockquote>
517
518     <p>The <code>%v</code> is used to log the name of the virtual
519     host that is serving the request. Then a program like <a href="programs/other.html">split-logfile</a> can be used to
520     post-process the access log in order to split it into one file
521     per virtual host.</p>
522   <h2><a name="other">Other Log Files</a></h2>
523     
524     
525     <table border="1"><tr><td valign="top"><strong>Related Modules</strong><br/><br/><code><a href="./mod/mod_cgi.html">mod_cgi</a></code><br/><code><a href="./mod/mod_rewrite.html">mod_rewrite</a></code><br/></td><td valign="top"><strong>Related Directives</strong><br/><br/><a href="./mod/core.html#pidfile" class="directive"><code class="directive">PidFile</code></a><br/><a href="./mod/mod_rewrite.html#rewritelog" class="directive"><code class="directive">RewriteLog</code></a><br/><a href="./mod/mod_rewrite.html#rewriteloglevel" class="directive"><code class="directive">RewriteLogLevel</code></a><br/><a href="./mod/mod_cgi.html#scriptlog" class="directive"><code class="directive">ScriptLog</code></a><br/><a href="./mod/mod_cgi.html#scriptloglength" class="directive"><code class="directive">ScriptLogLength</code></a><br/><a href="./mod/mod_cgi.html#scriptbuffer" class="directive"><code class="directive">ScriptBuffer</code></a><br/></td></tr></table>
526     
527     <h3><a name="pidfile">PID File</a></h3>
528       
529     
530       <p>On startup, Apache httpd saves the process id of the parent
531       httpd process to the file <code>logs/httpd.pid</code>. This
532       filename can be changed with the <a href="./mod/core.html#pidfile
533       " class="directive"><code class="directive">PidFile
534       </code></a> directive. The
535       process-id is for use by the administrator in restarting and
536       terminating the daemon by sending signals to the parent
537       process; on Windows, use the -k command line option instead.
538       For more information see the <a href="stopping.html">Stopping
539       and Restarting</a> page.</p>    
540     
541     
542     <h3><a name="scriptlog">Script Log</a></h3>
543       
544       
545       <p>In order to aid in debugging, the <a href="./mod/mod_cgi.html#
546       scriptlog" class="directive"><code class="directive">
547       ScriptLog</code></a> directive
548       allows you to record the input to and output from CGI scripts.
549       This should only be used in testing - not for live servers.
550       More information is available in the <a href="mod/mod_cgi.html">mod_cgi documentation</a>.</p>
551     
552     
553     <h3><a name="rewritelog">Rewrite Log</a></h3>
554       
555       
556       <p>When using the powerful and complex features of <a href="mod/mod_rewrite.html">mod_rewrite</a>, it is almost
557       always necessary to use the <a href="./mod/mod_rewrite.html#
558       rewritelog" class="directive"><code class="directive">
559       RewriteLog</code></a> to help
560       in debugging. This log file produces a detailed analysis of how
561       the rewriting engine transforms requests. The level of detail
562       is controlled by the <a href="./mod/mod_rewrite.html#
563       rewriteloglevel" class="directive"><code class="directive">
564       RewriteLogLevel</code></a> directive.</p>
565     
566   <hr/></blockquote><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img src="./images/index.gif" alt="Index"/></a><a href="./"><img src="./images/home.gif" alt="Home"/></a></body></html>