2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="mod_log_forensic.xml.meta">
25 <name>mod_log_forensic</name>
26 <description>Forensic Logging of the requests made to the server</description>
27 <status>Extension</status>
28 <sourcefile>mod_log_forensic.c</sourcefile>
29 <identifier>log_forensic_module</identifier>
30 <compatibility><module>mod_unique_id</module> is no longer required since
31 version 2.1</compatibility>
34 <p>This module provides for forensic logging of client
35 requests. Logging is done before and after processing a request, so the
36 forensic log contains two log lines for each request.
37 The forensic logger is very strict, which means:</p>
40 <li>The format is fixed. You cannot modify the logging format at
42 <li>If it cannot write its data, the child process
43 exits immediately and may dump core (depending on your
44 <directive module="mpm_common">CoreDumpDirectory</directive>
48 <p>The <code>check_forensic</code> script, which can be found in the
49 distribution's support directory, may be helpful in evaluating the
50 forensic log output.</p>
52 <seealso><a href="../logs.html">Apache Log Files</a></seealso>
53 <seealso><module>mod_log_config</module></seealso>
55 <section id="formats"><title>Forensic Log Format</title>
56 <p>Each request is logged two times. The first time is <em>before</em> it's
57 processed further (that is, after receiving the headers). The second log
58 entry is written <em>after</em> the request processing at the same time
59 where normal logging occurs.</p>
61 <p>In order to identify each request, a unique request ID is assigned.
62 This forensic ID can be cross logged in the normal transfer log using the
63 <code>%{forensic-id}n</code> format string. If you're using
64 <module>mod_unique_id</module>, its generated ID will be used.</p>
66 <p>The first line logs the forensic ID, the request line and all received
67 headers, separated by pipe characters (<code>|</code>). A sample line
68 looks like the following (all on one line):</p>
71 +yQtJf8CoAB4AAFNXBIEAAAAA|GET /manual/de/images/down.gif
72 HTTP/1.1|Host:localhost%3a8080|User-Agent:Mozilla/5.0 (X11;
73 U; Linux i686; en-US; rv%3a1.6) Gecko/20040216
74 Firefox/0.8|Accept:image/png, <var>etc...</var>
77 <p>The plus character at the beginning indicates that this is the first log
78 line of this request. The second line just contains a minus character and
82 -yQtJf8CoAB4AAFNXBIEAAAAA
85 <p>The <code>check_forensic</code> script takes as its argument the name
86 of the logfile. It looks for those <code>+</code>/<code>-</code> ID pairs
87 and complains if a request was not completed.</p>
90 <section id="security"><title>Security Considerations</title>
92 href="../misc/security_tips.html#serverroot">security tips</a>
93 document for details on why your security could be compromised
94 if the directory where logfiles are stored is writable by
95 anyone other than the user that starts the server.</p>
99 <name>ForensicLog</name>
100 <description>Sets filename of the forensic log</description>
101 <syntax>ForensicLog <var>filename</var>|<var>pipe</var></syntax>
102 <contextlist><context>server config</context><context>virtual host</context>
106 <p>The <directive>ForensicLog</directive> directive is used to
107 log requests to the server for forensic analysis. Each log entry
108 is assigned a unique ID which can be associated with the request
109 using the normal <directive module="mod_log_config">CustomLog</directive>
110 directive. <module>mod_log_forensic</module> creates a token called
111 <code>forensic-id</code>, which can be added to the transfer log
112 using the <code>%{forensic-id}n</code> format string.</p>
114 <p>The argument, which specifies the location to which
115 the logs will be written, can take one of the following two
119 <dt><var>filename</var></dt>
120 <dd>A filename, relative to the <directive module="core"
121 >ServerRoot</directive>.</dd>
123 <dt><var>pipe</var></dt>
124 <dd>The pipe character "<code>|</code>", followed by the path
125 to a program to receive the log information on its standard
126 input. The program name can be specified relative to the <directive
127 module="core">ServerRoot</directive> directive.
129 <note type="warning"><title>Security:</title>
130 <p>If a program is used, then it will be run as the user who
131 started <program>httpd</program>. This will be root if the server was
132 started by root; be sure that the program is secure or switches to a
133 less privileged user.</p>
136 <note><title>Note</title>
137 <p>When entering a file path on non-Unix platforms, care should be taken
138 to make sure that only forward slashes are used even though the platform
139 may allow the use of back slashes. In general it is a good idea to always
140 use forward slashes throughout the configuration files.</p>