mod_log_forensic.xml revision 43b02f0853f60a61d0ade525c8f578daf26dc189
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<?xml version="1.0"?>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<!--
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd Copyright 2004 The Apache Software Foundation
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
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
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd http://www.apache.org/licenses/LICENSE-2.0
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
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-->
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<modulesynopsis metafile="mod_log_forensic.xml.meta">
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<name>mod_log_forensic</name>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<description>Forensic Logging of the requests made to the server</description>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<status>Extension</status>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<sourcefile>mod_log_forensic.c</sourcefile>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<identifier>log_forensic_module</identifier>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<summary>
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
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <ul>
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>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd </ul>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
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</summary>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<seealso><a href="/logs.html">Apache Log Files</a></seealso>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<seealso><module>mod_log_config</module></seealso>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<section id="formats"><title>Forensic Log Format</title>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>Each request is logged two times. The first time <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
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
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
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <example>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd +yQtJf8CoAB4AAFNXBIEAAAAA|GET /manual/de/images/down.gif
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd HTTP/1.1|Host:localhost%3a8080|User-Agent:Mozilla/5.0 (X11;
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd U; Linux i686; en-US; rv%3a1.6) Gecko/20040216
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd Firefox/0.8|Accept:image/png, <var>etc...</var>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd </example>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>The plus character at the beginning indicates that this is first log
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd line of this request. The second line just contains a minus character and
43b02f0853f60a61d0ade525c8f578daf26dc189pepper the ID again:</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <example>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd -yQtJf8CoAB4AAFNXBIEAAAAA
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd </example>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
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>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<section id="security"><title>Security Considerations</title>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>See the <a
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</section>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<directivesynopsis>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<name>ForensicLog</name>
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<compatibility>Available in version 2.1 and later</compatibility>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<usage>
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
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
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <dl>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <dt><var>filename</var></dt>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <dd>A filename, relative to the <directive module="core"
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd >ServerRoot</directive>.</dd>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <dt><var>pipe</var></dt>
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 module="core">ServerRoot</directive> directive.
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <note type="warning"><title>Security:</title>
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 user.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd </note>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <note><title>Note</title>
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 </note></dd>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd </dl>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd</usage>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd</directivesynopsis>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd</modulesynopsis>