-
Notifications
You must be signed in to change notification settings - Fork 407
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
Avoid generating JSON with duplicate keys #721
Comments
Worth checking if the same won't happen with a field added from automatically from the |
Hi Nuno, Glad you raised this issue... funny enough we were debating about this exact same issue last week with @philsttr and decided to wait until someone complains about it ;-) Jackson already comes with a similar feature: We thought about different strategies on how to handle duplicates:
This strategy operates at runtime. Some duplicates may be detected earlier at configuration time (two JsonProviders with the same fieldName...). These cases should ideally be detected during startup as well. Any additional thought? Your feedback is welcome... PS: yes, MDC entries can cause duplicates as well... |
Hi Bertrand, Really happy to see such a warm reception to this issue 🙂 I think detecting these during startup should be really difficult since only when you try to build the messages you will be able to pinpoint if the issue will occur or not, no? I think enabling What I really fear is silent failure, which is what we experienced. In our case, only a single log line contained that issue, but it was enough to make almost 100% of the logs to be dropped and we were clueless about it. Why? Well, turns out Honestly I like the
Wondering if it would still be worth to raise a warning in that situation anyway.... |
I'm 100% with you... I'll try to focus on this issue as soon as I have some time. Stay tuned. |
Thank you so much @brenuart . I will be watching closely 😉 |
Hello, any news on the issue? |
we faced the same problem, any update? |
Describe the bug
Right now if someone adds a
logstash marker
with the same name as one of the default fields, it will generate a JSON with the two, which doesn't comply with JSON rules (no duplicate fields are allowed).To Reproduce
Create a log line with a logstash marker with a name you know will collide with a default one and then observe the generated JSON. Example:
Expected behavior
Having an invalid JSON (with duplicate keys) will result in a log ingestion issue with many system (had it with fluentbit). I would expect that, when constructing the JSON, any fields that would result in duplicate keys to be dropped (only the first added would be included). Additionally I would suggest some sort of warning to be printed, to raise people's attention to the mapping mistake they introduced, so they would fix it ASAP.
The text was updated successfully, but these errors were encountered: