#!/bin/bash # Custom Logger script to write out the apache log lines to both syslog # (for CSIRT ) and in a "normal" format to access_log for webalyzer [ -f /etc/sysconfig/httpd_syslogger ] && . /etc/sysconfig/httpd_syslogger if [ x"$HTTPDLOGGER_LOGFILE" = x"" ]; then LOG_FILE=/var/log/httpd/access_log else LOG_FILE="$HTTPDLOGGER_LOGFILE" fi if [ x"$HTTPDLOGGER_TAG" = x"" ]; then TAG="-t http-access" else TAG="-t $HTTPDLOGGER_TAG" fi # determine the log file: if the commandline args contains 'https' then # send it to 'ssl_access_log', otherwise send it to 'access_log' # # by default everything goes to http-access, and you have to look for the presence # of the TLS or SSL version if `echo "$@" | grep -q https 2> /dev/null` then if [ x"$HTTPDLOGGER_SSLLOGFILE" = x"" ]; then LOG_FILE=/var/log/httpd/ssl_access_log else LOG_FILE="$HTTPDLOGGER_SSLLOGFILE" fi if [ x"$HTTPDLOGGER_SSLTAG" = x"" ]; then TAG="-t https-access" else TAG="-t $HTTPDLOGGER_SSLTAG" fi fi if [ x"$HTTPDLOGGER_LOCALFILE" != x"no" ]; then exec /usr/bin/tee --append ${LOG_FILE} | /usr/bin/logger $TAG $HTTPDLOGGER_LOGARGS $@ else exec /usr/bin/logger $TAG $HTTPDLOGGER_LOGARGS $@ fi