Skip to content

fix(grok_parser transform): don't drop parsed field#1172

Merged
lukesteensen merged 2 commits intomasterfrom
fix-grok
Nov 13, 2019
Merged

fix(grok_parser transform): don't drop parsed field#1172
lukesteensen merged 2 commits intomasterfrom
fix-grok

Conversation

@lukesteensen
Copy link
Copy Markdown
Member

Similar to #1166, the grok parser has a problem handling cases where a parsed field name is the same as the source field name.

Signed-off-by: Luke Steensen <luke.steensen@gmail.com>
let mut drop_field = self.drop_field;
if let Some(value) = value {
if let Some(matches) = self.pattern.match_against(&value) {
for (name, value) in matches.iter() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could drop_field be calculated here as:

let drop_field = self.drop_field and !matches.contains_key(&self.field);

This would elimiate the let mut

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

Signed-off-by: Luke Steensen <luke.steensen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A code related bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants