out_loki: drop quotes after drop_single_key
Removes quotes from log lines when line_format=json and drop_single_key=true
Resolves concerns raised in #3005
Testing
- [x] Example configuration file for the change
[OUTPUT]
Name loki
....
label_keys $filename
line_format json
remove_keys filename
Drop_single_key true
-
[x] Debug log output from testing the change Before:
"Nov 19 15:48:36 hostname telegraf: 2021-11-19T15:48:36Z D! [outputs.prometheus_client] Wrote batch of 82 metrics in 648.331µs"After:Nov 19 16:05:36 hostname telegraf: 2021-11-19T16:05:36Z D! [outputs.prometheus_client] Wrote batch of 82 metrics in 809.535µs -
[x] Attached Valgrind output that shows no leaks or memory corruption was found
==5663==
==5663== HEAP SUMMARY:
==5663== in use at exit: 102,192 bytes in 3,426 blocks
==5663== total heap usage: 36,646 allocs, 33,220 frees, 7,755,146 bytes allocated
==5663==
==5663== LEAK SUMMARY:
==5663== definitely lost: 0 bytes in 0 blocks
==5663== indirectly lost: 0 bytes in 0 blocks
==5663== possibly lost: 0 bytes in 0 blocks
==5663== still reachable: 102,192 bytes in 3,426 blocks
==5663== suppressed: 0 bytes in 0 blocks
==5663== Rerun with --leak-check=full to see details of leaked memory
==5663==
==5663== For counts of detected and suppressed errors, rerun with: -v
==5663== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Documentation
- [ ] Documentation required for this feature
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Valid JSON by definition has quotes. Could you use key_value line_format instead?
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.
What is necessary to accept this PR?
The PR would help to prevent the needless quotes escape (\").
In my opinion, a new option should be introduced instead of breaking the existing behavior that conforms to line_format.
Something like a drop_single_key_as_raw_value configuration option?
Something like a
drop_single_key_as_raw_valueconfiguration option?
It could also be a special value for the drop_single_key option. Either way, this is a stale PR and discussion should move elsewhere.
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.