Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Apache httpd 2.2 server. I want to log all messages using syslog, so that the requests are sent to our central syslog server. I also want to ensure that all log messages are sent to local disk, so that a sysadmin can have easy access to the log files on the local system.

It is easy to send HTTP access logs to both the local disk and to syslog. One common method is:

LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog logs/access_log combined
CustomLog "|/usr/bin/logger -t httpd -i -p" combined

But it is not easy to do this for error logs. The following configuration doesn't work, because the error logs only use the last ErrorLog stanza. The first ErrorLog stanza is ignored.

ErrorLog logs/error_log
ErrorLog syslog:local4.error

How can I ensure that Apache errors logs are written to the local disk and are sent to syslog?

Is it possible to do this without touching /etc/syslog.conf ? I am fine if my users want to manage their own Apache configuration files, but I do not want them touching system files such as /etc/syslog.conf

share|improve this question
up vote 1 down vote accepted

Try sending all of ErrorLog to a pipe, for example a perl script. This perl script could direct to syslog and the local disk.

share|improve this answer
Something like this well-known Perl script, for example: – Stefan Lasiewski May 2 '12 at 20:11
Send it to whatever priority is already configured in your syslog.conf, and also open your log file and write $log there too. – Sirch May 2 '12 at 20:22

You can use:

ErrorLog "| tee -a /var/log/httpd/error_log | /usr/bin/logger -t httpd -i -p local4.error"

to do what you are after.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.