mod_log_forensic.xml revision 2985d8bb6c196e3e317abe91ac4a01ae2c375579
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
2985d8bb6c196e3e317abe91ac4a01ae2c375579yoshiki<!-- $Revision: 1.5 $ -->
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd Copyright 2004 The Apache Software Foundation
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd Licensed under the Apache License, Version 2.0 (the "License");
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd you may not use this file except in compliance with the License.
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd You may obtain a copy of the License at
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd Unless required by applicable law or agreed to in writing, software
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd distributed under the License is distributed on an "AS IS" BASIS,
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd See the License for the specific language governing permissions and
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd limitations under the License.
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<description>Forensic Logging of the requests made to the server</description>
a72c70f9ce5c04bcfa94d341315238f0d48e88c1nd<compatibility><module>mod_unique_id</module> is no longer required since
a72c70f9ce5c04bcfa94d341315238f0d48e88c1ndversion 2.1</compatibility>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>This module provides for forensic logging of client
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd requests. Logging is done before and after processing a request, so the
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd forensic log contains two log lines for each request.
43b02f0853f60a61d0ade525c8f578daf26dc189pepper The forensic logger is very strict, which means:</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <li>The format is fixed. You cannot modify the logging format at
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd runtime.</li>
43b02f0853f60a61d0ade525c8f578daf26dc189pepper <li>If it cannot write its data, the child process
43b02f0853f60a61d0ade525c8f578daf26dc189pepper exits immediately and may dump core (depending on your
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <directive module="mpm_common">CoreDumpDirectory</directive>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd configuration).</li>
43b02f0853f60a61d0ade525c8f578daf26dc189pepper <p>The <code>check_forensic</code> script, which can be found in the
43b02f0853f60a61d0ade525c8f578daf26dc189pepper distribution's support directory, may be helpful in evaluating the
43b02f0853f60a61d0ade525c8f578daf26dc189pepper forensic log output.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<seealso><a href="/logs.html">Apache Log Files</a></seealso>
2985d8bb6c196e3e317abe91ac4a01ae2c375579yoshiki <p>Each request is logged two times. The first time is <em>before</em> it's
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd processed further (that is, after receiving the headers). The second log
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd entry is written <em>after</em> the request processing at the same time
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd where normal logging occurs.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>In order to identify each request, a unique request ID is assigned.
43b02f0853f60a61d0ade525c8f578daf26dc189pepper This forensic ID can be cross logged in the normal transfer log using the
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <code>%{forensic-id}n</code> format string. If you're using
43b02f0853f60a61d0ade525c8f578daf26dc189pepper <module>mod_unique_id</module>, its generated ID will be used.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>The first line logs the forensic ID, the request line and all received
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd headers, separated by pipe characters (<code>|</code>). A sample line
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd looks like the following (all on one line):</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd HTTP/1.1|Host:localhost%3a8080|User-Agent:Mozilla/5.0 (X11;
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd </example>
2985d8bb6c196e3e317abe91ac4a01ae2c375579yoshiki <p>The plus character at the beginning indicates that this is the first log
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd line of this request. The second line just contains a minus character and
43b02f0853f60a61d0ade525c8f578daf26dc189pepper the ID again:</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd -yQtJf8CoAB4AAFNXBIEAAAAA
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd </example>
43b02f0853f60a61d0ade525c8f578daf26dc189pepper <p>The <code>check_forensic</code> script takes as its argument the name
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd of the logfile. It looks for those <code>+</code>/<code>-</code> ID pairs
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd and complains if a request was not completed.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<section id="security"><title>Security Considerations</title>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd href="/misc/security_tips.html#serverroot">security tips</a>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd document for details on why your security could be compromised
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd if the directory where logfiles are stored is writable by
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd anyone other than the user that starts the server.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<directivesynopsis>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<description>Sets filename of the forensic log</description>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<syntax>ForensicLog <var>filename</var>|<var>pipe</var></syntax>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<contextlist><context>server config</context><context>virtual host</context>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd</contextlist>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>The <directive>ForensicLog</directive> directive is used to
43b02f0853f60a61d0ade525c8f578daf26dc189pepper log requests to the server for forensic analysis. Each log entry
43b02f0853f60a61d0ade525c8f578daf26dc189pepper is assigned a unique ID which can be associated with the request
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd using the normal <directive module="mod_log_config">CustomLog</directive>
43b02f0853f60a61d0ade525c8f578daf26dc189pepper directive. <module>mod_log_forensic</module> creates a token called
43b02f0853f60a61d0ade525c8f578daf26dc189pepper <code>forensic-id</code>, which can be added to the transfer log
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd using the <code>%{forensic-id}n</code> format string.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>The argument, which specifies the location to which
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd the logs will be written, can take one of the following two
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd types of values:</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <dd>The pipe character "<code>|</code>", followed by the path
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd to a program to receive the log information on its standard
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd input. The program name can be specified relative to the <directive
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>If a program is used, then it will be run as the user who
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd started httpd. This will be root if the server was started by root;
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd be sure that the program is secure or switches to a less privileged
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>When entering a file path on non-Unix platforms, care should be taken
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd to make sure that only forward slashed are used even though the platform
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd may allow the use of back slashes. In general it is a good idea to always
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd use forward slashes throughout the configuration files.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd</directivesynopsis>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd</modulesynopsis>