Created
October 24, 2012 14:01
-
-
Save benclark/3946201 to your computer and use it in GitHub Desktop.
Perl script that is capable of sending httpd logs to syslog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Sys::Syslog qw( :DEFAULT setlogsock ); | |
openlog('httpd', 'cons,pid', LOG_LOCAL0); | |
while ($log = <STDIN>) { | |
syslog(LOG_NOTICE, $log); | |
} | |
closelog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adaptation of the Perl script on this page: http://www.oreillynet.com/pub/a/sysadmin/2006/10/12/httpd-syslog.html
The original version was coming into Papertrail prefixed by "kernel", rather than correctly identifying the httpd process. I reviewed the
Sys::Syslog
documentation and made some adjustments.