Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

captures with same name won't coerce properly #165

Open
kares opened this issue Dec 2, 2020 · 0 comments
Open

captures with same name won't coerce properly #165

kares opened this issue Dec 2, 2020 · 0 comments

Comments

@kares
Copy link
Contributor

kares commented Dec 2, 2020

If a patterns contains multiple captures with same name (e.g. due using (PATTERN1)|(PATTERN2)) than coercion part does not work as expected.

Reproducer:

>> grok = LogStash::Filters::Grok.new 'match' => { 'message' => "a%{INT:[foo][bar]:int}|b%{INT:[foo][bar]:int}" } 
>> grok.register

>> grok.filter e = LogStash::Event.new('message' => 'a123'); e.to_hash
=> {"message"=>"a123", "@version"=>"1", "@timestamp"=>2020-12-02T12:56:39.060Z, "foo"=>{"bar"=>123}}
>> grok.filter e = LogStash::Event.new('message' => 'b123'); e.to_hash
=> {"message"=>"b123", "@version"=>"1", "@timestamp"=>2020-12-02T12:56:43.966Z, "foo"=>{"bar"=>"123"}}

... notice the seconds case keeping the raw "123" instead of 123.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant