mod_log_config.c revision 10a4cdd68ef1ca0e54af296fe1d08ac00150c90b
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder/* ====================================================================
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * The Apache Software License, Version 1.1
6d81916b9004f8d9b6032113c5987ab07da47015Karl Luc * Copyright (c) 2000 The Apache Software Foundation. All rights
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * Redistribution and use in source and binary forms, with or without
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * modification, are permitted provided that the following conditions
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * 1. Redistributions of source code must retain the above copyright
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * notice, this list of conditions and the following disclaimer.
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * 2. Redistributions in binary form must reproduce the above copyright
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * notice, this list of conditions and the following disclaimer in
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * the documentation and/or other materials provided with the
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * distribution.
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * 3. The end-user documentation included with the redistribution,
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * if any, must include the following acknowledgment:
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * "This product includes software developed by the
d6ce032cac688f3698be7133d27f53d3967e6749Christian Maeder * Apache Software Foundation (http://www.apache.org/)."
de03ed90ff6efbbc4751301bcf6b50d9790c1afbKarl Luc * Alternately, this acknowledgment may appear in the software itself,
de03ed90ff6efbbc4751301bcf6b50d9790c1afbKarl Luc * if and wherever such third-party acknowledgments normally appear.
66977d201b3ff7ee9c1f992c0f3f701b69eac2c9Karl Luc * 4. The names "Apache" and "Apache Software Foundation" must
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * not be used to endorse or promote products derived from this
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * software without prior written permission. For written
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * permission, please contact apache@apache.org.
3831cf8a3b0ea144a80d13fe0314cc2752e32107Christian Maeder * 5. Products derived from this software may not be called "Apache",
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * nor may "Apache" appear in their name, without prior written
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * permission of the Apache Software Foundation.
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
d6ce032cac688f3698be7133d27f53d3967e6749Christian Maeder * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
de03ed90ff6efbbc4751301bcf6b50d9790c1afbKarl Luc * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
c51d1f5ff88cce030fe543e271ca6b85625b70d8Karl Luc * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
c51d1f5ff88cce030fe543e271ca6b85625b70d8Karl Luc * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
d75d2d11170f1339ebe37d9d9c06aff148637b13Christian Maeder * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
c51d1f5ff88cce030fe543e271ca6b85625b70d8Karl Luc * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
b696e806e85f1c07f2f5ea07f2b5babcd656e0d6Karl Luc * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
c51d1f5ff88cce030fe543e271ca6b85625b70d8Karl Luc * SUCH DAMAGE.
51846950b4b1f31342008cf17f667859a5f21949Christian Maeder * ====================================================================
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * This software consists of voluntary contributions made by many
c51d1f5ff88cce030fe543e271ca6b85625b70d8Karl Luc * individuals on behalf of the Apache Software Foundation. For more
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * information on the Apache Software Foundation, please see
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * Portions of this software are based upon public domain software
d6ce032cac688f3698be7133d27f53d3967e6749Christian Maeder * originally written at the National Center for Supercomputing Applications,
de03ed90ff6efbbc4751301bcf6b50d9790c1afbKarl Luc * University of Illinois, Urbana-Champaign.
3831cf8a3b0ea144a80d13fe0314cc2752e32107Christian Maeder * Modified by djm@va.pubnix.com:
c51d1f5ff88cce030fe543e271ca6b85625b70d8Karl Luc * If no TransferLog is given explicitly, decline to log.
c51d1f5ff88cce030fe543e271ca6b85625b70d8Karl Luc * This is module implements the TransferLog directive (same as the
3831cf8a3b0ea144a80d13fe0314cc2752e32107Christian Maeder * common log module), and additional directives, LogFormat and CustomLog.
7165a916d2fa1bf87c4741ec63b253413eebbf69Karl Luc * TransferLog fn Logs transfers to fn in standard log format, unless
de03ed90ff6efbbc4751301bcf6b50d9790c1afbKarl Luc * a custom format is set with LogFormat
de03ed90ff6efbbc4751301bcf6b50d9790c1afbKarl Luc * LogFormat format Set a log format from TransferLog files
de03ed90ff6efbbc4751301bcf6b50d9790c1afbKarl Luc * CustomLog fn format
c51d1f5ff88cce030fe543e271ca6b85625b70d8Karl Luc * Log to file fn with format given by the format
* TransferLog logs/access_log
* TransferLog log/virtual_only
* CustomLog log/virtual_useragents "%t %{user-agent}i"
#include "apr_strings.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "http_protocol.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#ifdef PIPE_BUF
const char *default_format_string;
const char *fname;
const char *format_string;
char *condition_var;
#ifdef BUFFERED_LOGS
int outcnt;
char *arg;
int condition_sense;
int want_orig;
return format_integer(p, i);
return stuff;
return ap_get_remote_logname(r);
return rvalue;
: r->the_request;
return r->filename;
return r->uri;
if (!r->sent_bodyct) {
long int bs;
if (cp) {
return cp;
char sign;
int timz;
if (timz < 0) {
/ APR_USEC_PER_SEC);
return ap_get_server_name(r);
static struct log_item_list {
char ch;
int want_orig_default;
} log_item_keys[] = {
return &log_item_keys[i];
return NULL;
const char **sa)
s = *sa;
s = *sa;
*sa = s;
return NULL;
const char *s = *sa;
struct log_item_list *l;
while (apr_isdigit(*++s)) {
l = find_log_func(*s++);
*sa = s;
return NULL;
char *res;
return NULL;
s = APR_EOL_STR;
const char *cp;
int in_list = 0;
#ifdef BUFFERED_LOGS
char *str, *s;
const char **strs;
int *strl;
char *envar;
return DECLINED;
return DECLINED;
return DECLINED;
orig = r;
while (r->next) {
r = r->next;
#ifdef BUFFERED_LOGS
s += strl[i];
s += strl[i];
s += strl[i];
return OK;
return OK;
return mls;
return add;
const char *name)
return err_string;
return err_string;
const char *fn)
{NULL}
!= APR_SUCCESS) {
#ifdef BUFFERED_LOGS
return cls;
const char *dummy;
const char *format;
if (format) {
if (format) {
if (format) {
return NULL;
open_multi_logs(s, p);
open_multi_logs(s, p);
#ifdef BUFFERED_LOGS
#ifdef BUFFERED_LOGS
for (; s; s = s->next) {
if (log_list) {
static void register_hooks(void)