guard against fields with nil name#10
guard against fields with nil name#10joemiller wants to merge 3 commits intologstash-plugins:mainfrom
Conversation
|
Thanks for your contribution |
|
your code looks good, but I would also add a few tests for it, so we could prevent for going back in a regression. As soon as we get this in, I'm very happy to proceed further with this Pr. |
|
@purbon Glad to do that. I could use some help in running the tests. When I try to run them locally with the |
|
Sorry for being slow with this. The tests are apparently disabled right now, see #11. It's trivial to temporarily reenable them (just remove |
|
@magnusbaeck thanks! Working on a test now. |
|
@magnusbaeck I added a test. I think it is sufficient. I did not re-enable the tests in the commit. I can do so if you'd like though. |
|
Update: working on a slightly different test. Standby |
1e41aaf to
5b7e14a
Compare
|
Ok. I think it's ready now. I changed the unit test so that it is more explicit about what it's excercising. |
No thanks—let's do that separately. The PR looks reasonable from a super quick look. I'll try to have a closer look during Monday. |
| unless @whitelist_names.empty? | ||
| @whitelist_names_regexp = Regexp.union(@whitelist_names.map {|x| Regexp.new(event.sprintf(x))}) if @interpolate | ||
| hash.each_key do |field| | ||
| next if field.nil? |
There was a problem hiding this comment.
can we add a log line for this behaviour? specially when we aim to debug this behaviour why is not creating the fields the user is expecting to?
|
@joemiller small question. When do you have this nil fields? can you write an example? can we do also better regexp? what do you think? |
|
Thinking more about this, what is a user's expected behavior if you do get a field with a nil key (apart from not crashing, obviously)? The nil key can't possibly match the whitelist pattern(s) so from that perspective it makes sense to prune it. In other words, if you use the prune filter with a non-empty
Sorry, I don't understand this comment. |
|
re
I was thinking about another plugin, so please apologies :-( @magnusbaeck I agree we should see this in user point of view, i agree with your reasoning. I end up mixing in this comment the kv filter and this one, shame on me. |
|
so I guess if we add logs to this being skipped I think we are good to merge. |
|
What's the status here? Any updates? |
|
Sorry, have not been able to work on this recently. On Fri, Aug 5, 2016 at 12:32 PM Andrew Cholakian notifications@github.com
|
|
Is filtering |
No, see elastic/logstash#2707 (which, incorrectly IMHO, references back to this issue). |
Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/
see #9