8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd<!-- $LastChangedRevision$ -->
031b91a62d25106ae69d4693475c79618dd5e884fielding Licensed to the Apache Software Foundation (ASF) under one or more
031b91a62d25106ae69d4693475c79618dd5e884fielding contributor license agreements. See the NOTICE file distributed with
031b91a62d25106ae69d4693475c79618dd5e884fielding this work for additional information regarding copyright ownership.
031b91a62d25106ae69d4693475c79618dd5e884fielding The ASF licenses this file to You under the Apache License, Version 2.0
031b91a62d25106ae69d4693475c79618dd5e884fielding (the "License"); you may not use this file except in compliance with
031b91a62d25106ae69d4693475c79618dd5e884fielding the License. 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>
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>
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar <p>The log files may contain sensitive data such as the contents of
7508cec8a4d5d744abbe2cdd5062d35f2f703effhumbedooh <code>Authorization:</code> headers (which can contain passwords), so
7508cec8a4d5d744abbe2cdd5062d35f2f703effhumbedooh they should not be readable by anyone except the user that starts the
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
a1ef40892ffa2b44fc249423c5b6c42a74a84c68nd started <program>httpd</program>. This will be root if the server was
a1ef40892ffa2b44fc249423c5b6c42a74a84c68nd started by root; be sure that the program is secure or switches to a
a1ef40892ffa2b44fc249423c5b6c42a74a84c68nd less privileged user.</p>
8c7242e280b348dd7f5c8f0bb28f773aaac2ef18nd <p>When entering a file path on non-Unix platforms, care should be taken
c54b0476dcf16b7103d81f5c20629aa565fd9e24rbowen to make sure that only forward slashes are used even though the platform
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim 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>