From: Martin Holste Date: Sat, 21 Apr 2012 14:32:58 +0000 (-0500) Subject: Added Syslog action for logging to local syslog X-Git-Tag: suricata-1.3beta2~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e179cbc236b431ac88ef48a1ad002ee2bf2333bc;p=thirdparty%2Fsuricata.git Added Syslog action for logging to local syslog --- diff --git a/contrib/file_processor/Action/Syslog.pm b/contrib/file_processor/Action/Syslog.pm new file mode 100644 index 0000000000..6b7c31a152 --- /dev/null +++ b/contrib/file_processor/Action/Syslog.pm @@ -0,0 +1,20 @@ +package Action::Syslog; +use Moose; +extends 'Processor'; +use Sys::Syslog qw(:standard :macros); + +our $Program = 'suricata_file'; +our $Facility = LOG_LOCAL0; +has 'data' => (is => 'rw', isa => 'HashRef', required => 1); + +sub name { 'syslog' } +sub description { 'Log to local syslog' } + +sub perform { + my $self = shift; + openlog($Program, undef, $Facility); + syslog(LOG_INFO, $self->json->encode($self->data)); + closelog; +} + +1