-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix parsing of interface options with _ (#4334) #4378
Conversation
Can one of the admins verify this patch? |
Sorry heading out for tonight but wanted to share my findings in regard to issue #4334.
|
Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run. |
@zecke Thanks a lot for bringing this up. If you are right, it seems that this could affect quite a few more variables. |
Hmm, yeah, looks like this broke with #2928. :( @zecke Thanks a lot for finding & fixing this. Can you add Our system tests didn't catch these because they always work on reading from files, rather than opening an interface. |
In commit 5547060 linting issues were addresses and variables containing _ were renamed. This broke the config parsing. In packetbeat this seems to effect the with_vlans, bpf_filter and the buffer_size_mb options. Correct it by adding tags for all documented variables.
@tsg Shouldn't bpf_filter work for reading from files too? I have not looked at the test setup but setting a filter that should only match a subset of the packets in a file and verifying the number of imported packets should be doable? I annotated the struct (and aligned the tags to match the longest one). I have left the last options out as they are not documented in the reference file and I didn't know what is being used (top_speed, topspeed, topSpeed) |
Thanks for fixing this, this was preventing us from monitoring a busy interface, I guess this PR will be merged soon ? |
@zecke Currently it's not applied on reading from file. We could implement it, but then it would probably be a different setting, because this one applies to "interfaces"? I'm going to merge it for now like this and improve on the system tests if something like this ever surfaces again. I'll add the Changelog while backporting, thanks a lot for the fix! |
In commit 5547060 linting issues were addresses and variables containing _ were renamed. This broke the config parsing. In packetbeat this seems to effect the with_vlans, bpf_filter and the buffer_size_mb options. Correct it by adding tags for all documented variables. (cherry picked from commit 813466d)
) (#4411) * Fix parsing of interface options with _ (#4334) (#4378) In commit 5547060 linting issues were addresses and variables containing _ were renamed. This broke the config parsing. In packetbeat this seems to effect the with_vlans, bpf_filter and the buffer_size_mb options. Correct it by adding tags for all documented variables. (cherry picked from commit 813466d)
In elastic#4378 we briefly discussed how to test the parsing of config parameters. The way ucfg works is that the yaml/json is unpacked into the struct and with the current approach at least two issues can occur: 1.) One can have entries in the config file that are not consumed 2.) One can have members in the struct that are not filled To allow testing proper parsing of a valid configuration file and help users to show what has been passed I introduce a new config option. Instead of forcing this new method for the existing Beater interface, add a new introspection interface... TODO: Is this a sound approach? Shall a list of interfaces be returned? Print them to a file? What about the b.Config? How to add this as a system test? TODO: Don't use go-yaml/yaml but the one used by ucfg?
@tsg "interfaces": True, let's not do that then. In zecke@73e275d I created a new interface (to allow easy porting of the existing beats?!) and played a bit with printing a yaml representation of what has been parsed. It prints something like this... I think in general it is a nice addition:
What do you think?
|
In commit 5547060 linting issues
were addresses and variables containing _ were renamed. This broke
the config parsing.
In packetbeat this seems to effect the with_vlans, bpf_filter and
the buffer_size_mb options. Correct it by using a tag in the structure.