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