This queue is for tickets about the Parse-Syslog CPAN distribution.

Report information
The Basics
Id:
59229
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
aidan_kissane [...] hotmail.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Support for '-- Mark --' messages
Date: Fri, 9 Jul 2010 20:01:41 +0100
To: <bug-Parse-Syslog@rt.cpan.org>
From: "Aidan Kissane" <aidan_kissane@hotmail.com>
Hi,
 
This is not so much a bug report as more of a feature request.
 
Version 1.10 of Parse::Syslog skips '-- Mark --' messages without giving the script that uses the module a choice. Maybe a better option with be to not ignore the mark message but give the script using the module the option of whiter to act on it or not. I have made my own version of Parse::Syslog which works quite well and maybe this solution could be implemented in the module. I have changed the following lines:
 
Show quoted text
.
.

        # marks
        next if $text eq '-- MARK --';
 
        # some systems send over the network their
        # hostname prefixed to the text. strip that.
        $text =~ s/^$host\s+//;
.
.
 
to:
Show quoted text
.
.
.
 
  # marks
 if ($text eq '-- MARK --') {
   if($self->{arrayref}) {
    $self->{_last_data}{$host} = [
     $time,  # 0: timestamp
     $host,  # 1: host     
     $text,  # 2: mark  
     ];
   }
   else {
    $self->{_last_data}{$host} = {
     timestamp => $time,
     host      => $host,
     mark   => $text,     
    };
   }
  }
  else {
 
   # some systems send over the network their
   # hostname prefixed to the text. strip that.
   $text =~ s/^$host\s+//;
.
.
 
Then in the script that uses Parse::Syslog I can choose whether to act on mark messages or not:
Show quoted text
.
.
.
my $syslogparser = Parse::Syslog->new( File::Tail->new($syslogfile), type => "syslog" );
while ($syslogmsg = $syslogparser->next) {
   next if ( $syslogmsg->{mark} ); # Skip message if it is a mark
.
.
}
 
Or by checking if 3rd element in array eq '-- Mark --'.
 
 


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.