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>
32 <p>This module provides for forensic logging of client
33 requests. Logging is done before and after processing a request, so the
34 forensic log contains two log lines for each request.
35 The forensic logger is very strict, which means:</p>
38 <li>The format is fixed. You cannot modify the logging format at
40 <li>If it cannot write its data, the child process
41 exits immediately and may dump core (depending on your
42 <directive module="mpm_common">CoreDumpDirectory</directive>
46 <p>The <code>check_forensic</code> script, which can be found in the
47 distribution's support directory, may be helpful in evaluating the
48 forensic log output.</p>
50 <seealso><a href="../logs.html">Apache Log Files</a></seealso>
51 <seealso><module>mod_log_config</module></seealso>
53 <section id="formats"><title>Forensic Log Format</title>
54 <p>Each request is logged two times. The first time is <em>before</em> it's
55 processed further (that is, after receiving the headers). The second log
56 entry is written <em>after</em> the request processing at the same time
57 where normal logging occurs.</p>
59 <p>In order to identify each request, a unique request ID is assigned.
60 This forensic ID can be cross logged in the normal transfer log using the
61 <code>%{forensic-id}n</code> format string. If you're using
62 <module>mod_unique_id</module>, its generated ID will be used.</p>
64 <p>The first line logs the forensic ID, the request line and all received
65 headers, separated by pipe characters (<code>|</code>). A sample line
66 looks like the following (all on one line):</p>
69 +yQtJf8CoAB4AAFNXBIEAAAAA|GET /manual/de/images/down.gif
70 HTTP/1.1|Host:localhost%3a8080|User-Agent:Mozilla/5.0 (X11;
71 U; Linux i686; en-US; rv%3a1.6) Gecko/20040216
72 Firefox/0.8|Accept:image/png, <var>etc...</var>
75 <p>The plus character at the beginning indicates that this is the first log
76 line of this request. The second line just contains a minus character and
80 -yQtJf8CoAB4AAFNXBIEAAAAA
83 <p>The <code>check_forensic</code> script takes as its argument the name
84 of the logfile. It looks for those <code>+</code>/<code>-</code> ID pairs
85 and complains if a request was not completed.</p>
88 <section id="security"><title>Security Considerations</title>
90 href="../misc/security_tips.html#serverroot">security tips</a>
91 document for details on why your security could be compromised
92 if the directory where logfiles are stored is writable by
93 anyone other than the user that starts the server.</p>
94 <p>The log files may contain sensitive data such as the contents of
95 <code>Authorization:</code> headers (which can contain passwords), so
96 they should not be readable by anyone except the user that starts the
101 <name>ForensicLog</name>
102 <description>Sets filename of the forensic log</description>
103 <syntax>ForensicLog <var>filename</var>|<var>pipe</var></syntax>
104 <contextlist><context>server config</context><context>virtual host</context>
108 <p>The <directive>ForensicLog</directive> directive is used to
109 log requests to the server for forensic analysis. Each log entry
110 is assigned a unique ID which can be associated with the request
111 using the normal <directive module="mod_log_config">CustomLog</directive>
112 directive. <module>mod_log_forensic</module> creates a token called
113 <code>forensic-id</code>, which can be added to the transfer log
114 using the <code>%{forensic-id}n</code> format string.</p>
116 <p>The argument, which specifies the location to which
117 the logs will be written, can take one of the following two
121 <dt><var>filename</var></dt>
122 <dd>A filename, relative to the <directive module="core"
123 >ServerRoot</directive>.</dd>
125 <dt><var>pipe</var></dt>
126 <dd>The pipe character "<code>|</code>", followed by the path
127 to a program to receive the log information on its standard
128 input. The program name can be specified relative to the <directive
129 module="core">ServerRoot</directive> directive.
131 <note type="warning"><title>Security:</title>
132 <p>If a program is used, then it will be run as the user who
133 started <program>httpd</program>. This will be root if the server was
134 started by root; be sure that the program is secure or switches to a
135 less privileged user.</p>
138 <note><title>Note</title>
139 <p>When entering a file path on non-Unix platforms, care should be taken
140 to make sure that only forward slashes are used even though the platform
141 may allow the use of back slashes. In general it is a good idea to always
142 use forward slashes throughout the configuration files.</p>