Jan 152010
Sending Apache log to syslog?
Answer:
In the Apache config (httpd.conf), add/modify the followings as needed
1. For Access log
CustomLog |/usr/local/apache/bin/apache_syslog combined
Where apache_syslog is a Perl script
#!/usr/bin/perl
use Sys::Syslog qw( :DEFAULT setlogsock );
setlogsock('unix');
openlog('apache', 'cons', 'pid', 'local2');
while ($log = ) {
syslog('notice', $log);
}
closelog
2. For Error log
Apache already has direct support error log to syslog, so just add the target syslog facility.
ErrorLog syslog:local1
This tells Apache to send the error log output to the syslog facility local1