Skip to content

Instantly share code, notes, and snippets.

@benclark
Created October 24, 2012 14:01
Show Gist options
  • Save benclark/3946201 to your computer and use it in GitHub Desktop.
Save benclark/3946201 to your computer and use it in GitHub Desktop.
Perl script that is capable of sending httpd logs to syslog
#!/usr/bin/perl
use Sys::Syslog qw( :DEFAULT setlogsock );
openlog('httpd', 'cons,pid', LOG_LOCAL0);
while ($log = <STDIN>) {
syslog(LOG_NOTICE, $log);
}
closelog
@benclark
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment