Skip Menu |

This queue is for tickets about the POE-Component-Server-Syslog CPAN distribution.

Report information
The Basics
Id: 15785
Status: resolved
Priority: 0/
Queue: POE-Component-Server-Syslog

People
Owner: Nobody in particular
Requestors: mike.bristow [...] thus.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.02
Fixed in: (no value)

Attachments


Subject: [patch] compatibility with syslog-ng(?)
We have a syslog setup like so: [ device 1 ] -> [ main syslog server ] -> [ my test box ] Where the main syslog server is running syslog-ng, and accepts messages from a set of devices, rebroadcasting (some of) them to my test box. POE::Component::Server::Syslog fails to understand these messages - a simple test script: #!perl use POE; use POE::Component::Server::Syslog; use Data::Dumper; POE::Component::Server::Syslog->spawn(Type=>'udp', InputState => \&in) or die "ARGH!!!"; POE::Kernel->run; sub in { print Dumper $_[ARG0]; } Only prints out the first message. This appears to be because the embedded message contains a "\n", which confuses POE::Filter::Syslog's SYSLOG_REGEX. The solution I have tried - and appears to work - is attached. By handing the /s modifier to the regexes, we treat "\n" as Just Another Character. This has the effect of making ^ and $ mean "start of string" and "end of string" rather than start-of-line. This means that the text-gobbling ".*" eats the whole message, including the \n. This may have a less than satisfactory result for TCP streams, which I've not tested.
Index: POE-Component-Server-Syslog/lib/POE/Filter/Syslog.pm =================================================================== RCS file: /cvsroot/upstream/POE-Component-Server-Syslog/lib/POE/Filter/Syslog.pm,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Syslog.pm --- POE-Component-Server-Syslog/lib/POE/Filter/Syslog.pm 13 Mar 2005 21:08:42 -0000 1.1.1.1 +++ POE-Component-Server-Syslog/lib/POE/Filter/Syslog.pm 14 Nov 2005 17:40:12 -0000 @@ -42,7 +42,7 @@ my @found; if($stream and length $stream) { - while ( $stream =~ s/$SYSLOG_REGEXP//x ) { + while ( $stream =~ s/$SYSLOG_REGEXP//sx ) { my $time = $2 && parsedate("$2 $3 $4:$5:$6"); $time ||= time(); @@ -64,7 +64,7 @@ my $self = shift; my $found = 0; if($self->{buffer} and length $self->{buffer}) { - if ( $self->{buffer} =~ s/$SYSLOG_REGEXP//x ) { + if ( $self->{buffer} =~ s/$SYSLOG_REGEXP//xs ) { my $time = $2 && parsedate("$2 $3 $4:$5:$6"); my $msg = { time => $time,
did you run the test suite against your patch? the test suite does tests for both udp and tcp.
From: mike.bristow [...] thus.net
[SUNGO - Mon Nov 14 15:31:19 2005]: Show quoted text
> did you run the test suite against your patch? the test suite does tests > for both udp and tcp.
Not yet ... I'll do so in the morning
[guest - Mon Nov 14 15:53:04 2005]: Show quoted text
> [SUNGO - Mon Nov 14 15:31:19 2005]: >
> > did you run the test suite against your patch? the test suite does
> tests
> > for both udp and tcp.
> > Not yet ... I'll do so in the morning
Hmm; my reply didn't make it here. The answer is that the test suit passed just fine for multiple perl version on multiple OSes. I'll post the details I tried to post when I'm back in the office.
From: mike.bristow [...] thus.net
[guest - Tue Nov 15 15:05:31 2005]: Show quoted text
> > Hmm; my reply didn't make it here. > > The answer is that the test suit passed just fine for multiple perl > version on multiple OSes. > > I'll post the details I tried to post when I'm back in the office.
See attached build logs.
Download buildlog.zip
application/zip 26.3k

Message body not shown because it is not plain text.