-
Notifications
You must be signed in to change notification settings - Fork 97
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
Convert fields at grok match #109
Conversation
Instead of doing dedicated mutate convert action, we can convert known fields to integer or float right in grok match.
Interesting, I'll check what's the case with test failures. |
You got what you asked for :)
The list of results, which is a single float |
Well, yeah. I need to update expected values in fixtures, as grok does conversion in place with this change. |
@whyscream test runner explicitly converts expected data to string here. I'm not sure how to address this without updating the ton of other fixtures, if I'm leaving this for your judgement. |
The conversion in the test was probably added to work around this issue (reversed) with upstream patterns that are producing integers or floats. You changed quite a lot of result fields, so I'd expect that quite some tests will need updates too. I have no problems with changing the test suite in a way that causes the tests to detect proper data types too. The explicit conversion you're removing takes some extra cycles I assume, but does it cause that much additional load that your optimization actually helps? Just curious on how you got the idea for the proposed change. |
It's habit I developed over time writing custom grok patterns. It's easier and less error prone this way. For example, the removed mutate filter references fields that aren't present in grok template anymore, like As of test suite, I'll see what can be done with type conventions. Seems it's worth to refactor it to allow proper type matching. |
I tried to remove The issue is jordansissel/ruby-grok#29. Again, I'm not sure how to proceed from here as testing suite is FUBAR. Maybe switching to tests using logstash way is better here, ref: https://github.com/logstash-plugins/logstash-patterns-core/tree/master/spec. |
Thanks for trying! For now I'm leaving the type coercion as-is, when the grok library is fixed, we can revisit this issue, which looks like a nice improvement overall. |
Okay, I'm closing this for now and will track issue with jls-grok. Will create a new PR when mentioned issue resolved. |
Instead of doing dedicated mutate convert action, we can convert known fields to integer or float right in grok match.
Ref: https://www.elastic.co/guide/en/logstash/5.4/plugins-filters-grok.html#_grok_basics