Skip Menu |

This queue is for tickets about the Message-Passing-Filter-Regexp CPAN distribution.

Report information
The Basics
Id: 86199
Status: resolved
Priority: 0/
Queue: Message-Passing-Filter-Regexp

People
Owner: Nobody in particular
Requestors: abraxxa [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.03
Fixed in: 0.05



Subject: make @message and @fields configurable
Hi Rao, I'd appreciate if you make configurable where the message string to be parsed is taken from (currently $message->{'@message'} ), and where the captured parts are stored in the message (currently $message->{'@fields'} ). I'm using Message::Passing::Input::Syslog which puts the message into $message->{message} and ->{content} depending on what you prefer. There might be also a situation where $message is a plain string and not a hash in which case it should be used as is regardless of the configured message source. Thanks!
Subject: Re: [rt.cpan.org #86199] make @message and @fields configurable
Date: Mon, 17 Jun 2013 17:00:04 +0800
To: bug-Message-Passing-Filter-Regexp [...] rt.cpan.org
From: chenlin rao <rao.chenlin [...] gmail.com>
Currently I use Filter::Regexp after Filter::ToLogstash, $message would be parsed to such format by this filter. Has you try this filter? Anyway, I will try to make these two field configurable. 2013/6/17 Alexander Hartmaier via RT < bug-Message-Passing-Filter-Regexp@rt.cpan.org> Show quoted text
> Mon Jun 17 03:34:37 2013: Request 86199 was acted upon. > Transaction: Ticket created by ABRAXXA > Queue: Message-Passing-Filter-Regexp > Subject: make @message and @fields configurable > Broken in: 0.03 > Severity: Wishlist > Owner: Nobody > Requestors: alex.hartmaier@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=86199 > > > > Hi Rao, > I'd appreciate if you make configurable where the message string to be > parsed is taken from (currently $message->{'@message'} ), and where the > captured parts are stored in the message (currently $message->{'@fields'} ). > > I'm using Message::Passing::Input::Syslog which puts the message into > $message->{message} and ->{content} depending on what you prefer. > There might be also a situation where $message is a plain string and not a > hash in which case it should be used as is regardless of the configured > message source. > > Thanks! >
I don't use Filter::ToLogstash because I need more control about the message fields. Thanks for looking into it!
Subject: Re: [rt.cpan.org #86199] make @message and @fields configurable
Date: Wed, 19 Jun 2013 13:57:32 +0800
To: bug-Message-Passing-Filter-Regexp [...] rt.cpan.org
From: chenlin rao <rao.chenlin [...] gmail.com>
add a `fromto` attr.Please give a try~ 2013/6/17 Alexander Hartmaier via RT < bug-Message-Passing-Filter-Regexp@rt.cpan.org> Show quoted text
> Queue: Message-Passing-Filter-Regexp > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=86199 > > > I don't use Filter::ToLogstash because I need more control about the > message fields. > Thanks for looking into it! >
Works, thanks! It could be a bit more flexible, e.g. if you want to put the captured fields directly into the message hashref. Maybe add support for that via @message => undef or @message => ''. Do you know why logstash puts them in the subhash @fields?
Subject: Re: [rt.cpan.org #86199] make @message and @fields configurable
Date: Wed, 19 Jun 2013 16:28:28 +0800
To: bug-Message-Passing-Filter-Regexp [...] rt.cpan.org
From: chenlin rao <rao.chenlin [...] gmail.com>
I think author only want the message hash has fixed list of keys for better look (and parse)? He use '@' prefix for these public keys but not for the keys of sub hash. Seems like the instance var and var in Ruby. 2013/6/19 Alexander Hartmaier via RT < bug-Message-Passing-Filter-Regexp@rt.cpan.org> Show quoted text
> Queue: Message-Passing-Filter-Regexp > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=86199 > > > Works, thanks! > It could be a bit more flexible, e.g. if you want to put the captured > fields directly into the message hashref. > Maybe add support for that via @message => undef or @message => ''. > > Do you know why logstash puts them in the subhash @fields? >
To make it more flexible I've added support for fromto => { message => undef }: Replace line 98 of version 0.04 with: if (defined $to) { $message->{$to} = {%data}; } # put parsed fields directly in message hashref else { %$message = ( %$message, %data ); }
Subject: Re: [rt.cpan.org #86199] make @message and @fields configurable
Date: Fri, 12 Jul 2013 18:22:21 +0800
To: bug-Message-Passing-Filter-Regexp [...] rt.cpan.org
From: chenlin rao <rao.chenlin [...] gmail.com>
well, ok. I will upload v0.05 for this. Tks 2013/7/12 Alexander Hartmaier via RT < bug-Message-Passing-Filter-Regexp@rt.cpan.org> Show quoted text
> Queue: Message-Passing-Filter-Regexp > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=86199 > > > To make it more flexible I've added support for fromto => { message => > undef }: > > Replace line 98 of version 0.04 with: > > if (defined $to) { > $message->{$to} = {%data}; > } > # put parsed fields directly in message hashref > else { > %$message = ( %$message, %data ); > } >
Works fine, thanks! You can close the ticket.