-
Notifications
You must be signed in to change notification settings - Fork 27
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
Not possible to inject @metadata using fields section of config #142
Comments
@jgough I will have a look at this. It looks like it is resolvable, because passing
|
I looked into this a little bit more and it looks like we have two issues:
For the first, I think I can come up with a fix. @magnusbaeck What do you think about deep-merging? |
May I add my thoughts on deep merging? Interesting problem. I kind of personally feel that there are use cases for setting So I feel the following would make most sense: Case 1:
Should result in
Case 2:
Result:
Case 3:
Result:
( Case 4:
Result:
( |
There are legitimate use cases for both behaviors (deep merging and shallow merging) so we'll probably upset someone whatever we choose. The |
OK, if I got this right, the proposal from @jgough is exactly what @magnusbaeck has sumarized in
I will have a look at the current implementation in order to figure out the effort to achieve this. Of course, this distinction between json objects and Logstash syntax would need to be prominently highlighted in the documentation. |
Yes, you're right! I apparently didn't fully internalize the examples. But yes, this behavior would indeed have to be well-documented. Technically it would also be a backwards-incompatible change, so if we don't get it in for v2 we'd have to wait for v3. |
I think the generalized algorithm for this would go like this:
I think, this algorithm would handle all the test cases listed above by @jgough correctly. It is worth mentioning, that the value could be a "basic value" (e.g. string, number) or again an object (or an array). So it would be possible to do something like this:
which would result in
or again in JSON, the result would look like this:
What do you think? |
I did a first iteration to implement the above specification, but it is not as straight forward as I initially though. There are a lot of edge cases which we did not yet discuss, e.g. what logstash config fields are nested in regular objects? e.g.
Currently I have the feeling, that this could end up in a bigger refactoring of the test case processing logic and I see the risk, that the we need to duplicate this code in order to preserve backwards compatibility with the standalone (V1) mode. |
I've had some further thoughts on this. Maybe it would just be best to keep it simple and forbid mixing the two formats? Use one or the other - but not both. I was unaware of the non-logstash config way of doing it until recently. There's no reason I can see that anyone should need to mix them. |
Related to #126
With the fix for above now merged into master I'm building from master and trying to inject nested data into
@metadata
that would normally be added by the s3 plugin (which adds[@metadata][s3][key]
)If I try and inject
@metadata
then it does not get set correctly. For example a test with:outputs:
But I expected
Maybe instead I should be looking to mock the input plugin instead?
The text was updated successfully, but these errors were encountered: