Send Apache Access Logs to syslog

aixapache-2.2ihssyslog

We have IBM HTTP Servers (Based on Apache 2.0) and want to send the access logs to syslog. (in addition to error logs which does work)

The config we are using is as follows:

ErrorLog "|/HTTPServer/bin/rotatelogs /archive/http/error_log.%Y%m%d 86400 | /usr/bin/logger -t httpd -plocal6.err"
LogLevel warn
LogFormat "%h %{True-Client-IP}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D \"%{Host}i\" %v" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog "|exec /usr/bin/logger -t ptseelm-ax3004 -i -p local6.notice" combined

But the logs entries don't even appear in the local syslog.out

here is what the processes look like:

ps -ef | grep httpd
apache  6226000  8388618   0 09:04:01      -  0:00 /HTTPServer/bin/httpd -d /HTTPServer -k start
apache  6750220  8388618   0 09:04:01      -  0:00 /HTTPServer/bin/httpd -d /HTTPServer -k start
apache  7602390  8388618   0 09:04:01      -  0:00 /HTTPServer/bin/httpd -d /HTTPServer -k start
root  8388618        1   0 09:04:01      -  0:00 /HTTPServer/bin/httpd -d /HTTPServer -k start
root  9044038  8388618   0 09:04:01      -  0:00 /usr/bin/logger -t httpd -plocal6.err

So there is no logger attached to the child processes… is that the problem? Can someone help me out? 🙂

We have the following in syslog.conf:

local6.*        @somerealipaddress

Best Answer

I would suggest to instead of piping directly to logger, you would be better off writing to a file and then having a separate process read that file and send it off to syslog.

Many syslog programs, e.g. rsyslog and syslog-ng, can read from a file as well as from /dev/log. Another options is to simply use tail -F and pipe to logger.