/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/httpd-syslogger/httpd_syslog_logger
ViewVC logotype

Annotation of /trunk/nl.nikhef.ndpf.tools/httpd-syslogger/httpd_syslog_logger

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2737 - (hide annotations) (download)
Fri Oct 31 20:16:08 2014 UTC (7 years, 6 months ago) by davidg
File size: 1210 byte(s)
Initial version - sources form www.nikhef.nl

1 davidg 2737 #!/bin/bash
2    
3     # Custom Logger script to write out the apache log lines to both syslog
4     # (for CSIRT ) and in a "normal" format to access_log for webalyzer
5    
6     [ -f /etc/sysconfig/httpd_syslogger ] && . /etc/sysconfig/httpd_syslogger
7    
8     if [ x"$HTTPDLOGGER_LOGFILE" = x"" ]; then
9     LOG_FILE=/var/log/httpd/access_log
10     else
11     LOG_FILE="$HTTPDLOGGER_LOGFILE"
12     fi
13    
14     if [ x"$HTTPDLOGGER_TAG" = x"" ]; then
15     TAG="-t http-access"
16     else
17     TAG="-t $HTTPDLOGGER_TAG"
18     fi
19     # determine the log file: if the commandline args contains 'https' then
20     # send it to 'ssl_access_log', otherwise send it to 'access_log'
21     #
22     # by default everything goes to http-access, and you have to look for the presence
23     # of the TLS or SSL version
24    
25     if `echo "$@" | grep -q https 2> /dev/null`
26     then
27     if [ x"$HTTPDLOGGER_SSLLOGFILE" = x"" ]; then
28     LOG_FILE=/var/log/httpd/ssl_access_log
29     else
30     LOG_FILE="$HTTPDLOGGER_SSLLOGFILE"
31     fi
32     if [ x"$HTTPDLOGGER_SSLTAG" = x"" ]; then
33     TAG="-t https-access"
34     else
35     TAG="-t $HTTPDLOGGER_SSLTAG"
36     fi
37     fi
38    
39     if [ x"$HTTPDLOGGER_LOCALFILE" != x"no" ]; then
40     exec /usr/bin/tee --append ${LOG_FILE} | /usr/bin/logger $TAG $HTTPDLOGGER_LOGARGS $@
41     else
42     exec /usr/bin/logger $TAG $HTTPDLOGGER_LOGARGS $@
43     fi
44    

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28