2012/10/20 Mark D. Nagel <[email protected]>:
> On 10/20/2012 1:40 AM, Risto Vaarandi wrote:
>> a separate rule type is one option, but in my other mail I was
>> actually suggesting your approach -- to have an improved PerlFunc
>> pattern type, from which named match variables could be returned. In
>> this way, the parsing results can be stored with 'varmap' rule field,
>> and reused from other rules quite easily.
>
> Ah, so this is not currently possible then -- I thought you could
> already populate varmaps from PerlFunc patterns in 2.6.2? Or is it that
> you can't match a variable number of lines as you would have to for
> structured input?
What I meant was that with PerlFunc, you can return a list (a, b, c)
from a function which set $1, $2 and $3 variables, and then you can
create variables $+{first}, $+{second} and $+{third} with varmap=
first=1; second=2; third=3
On the other hand, Perl regular expressions allow for creating
$+{name} style variables directly without using varmap (however, for
caching the result, you would still need the varmap statement).
My idea was that if PerlFunc would return hashes in addition to lists,
named match variables could be naturally created from key=value pairs
that the hash contains. At this point, I am thinking about
implementing a check against the first return value from the function,
and if it happens to be a reference to a hash, create named match
variables from it. In that way, defining name=number mappings
explicitly with varmap could be avoided. Such way is very handy for
generic parsing of structured log messages, since quite often you
can't predict the actual keywords that appear in the message.
kind regards,
risto
>
> Thanks,
> Mark
>
> --
> Mark D. Nagel, CCIE #3177 <[email protected]>
> Principal Consultant, Willing Minds LLC (http://www.willingminds.com)
> cell: 949-279-5817, desk: 714-495-4001, fax: 714-646-8277
>
> ** For faster support response time, please
> ** email [email protected] or call 714-495-4000
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Simple-evcorr-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users