[SCM] libmessage-passing-perl Debian packaging branch, master, updated. debian/0.111-3-14-g44f6e88
Tomas Doran
bobtfish at bobtfish.net
Mon May 6 11:57:44 UTC 2013
The following commit has been merged in the master branch:
commit 72525bf57521c1f1335f361ec372714aa219aef4
Author: Tomas Doran <bobtfish at bobtfish.net>
Date: Mon Sep 3 22:38:31 2012 +0100
Add my own syslog udp input
diff --git a/lib/Message/Passing/Input/Syslog/UDP.pm b/lib/Message/Passing/Input/Syslog/UDP.pm
new file mode 100644
index 0000000..19a3717
--- /dev/null
+++ b/lib/Message/Passing/Input/Syslog/UDP.pm
@@ -0,0 +1,40 @@
+package Message::Passing::Input::Syslog::UDP;
+use Moo;
+use namespace::clean -except => 'meta';
+
+extends 'Message::Passing::Input::Socket::UDP';
+
+has '+port' => (
+ default => sub { 5140 },
+ required => 0,
+);
+
+our $SYSLOG_REGEXP = q|
+^<(\d+)> # priority -- 1
+ (?:
+ (\S{3})\s+(\d+) # month day -- 2, 3
+ \s
+ (\d+):(\d+):(\d+) # time -- 4, 5, 6
+ )?
+ \s*
+ (.*) # text -- 7
+$
+|;
+
+sub filter {
+ my ( $self, $message ) = @_;
+ if ( $message =~ s/$SYSLOG_REGEXP//sx ) {
+ my $time = $2 && parsedate("$2 $3 $4:$5:$6");
+ return {
+ time => $time,
+ pri => $1,
+ facility => int($1/8),
+ severity => int($1%8),
+ msg => $7,
+ };
+ }
+ return undef;
+}
+
+1;
+
--
libmessage-passing-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list