fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

out_loki: drop quotes after drop_single_key

Open mifrost opened this issue 4 years ago • 6 comments

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.

mifrost avatar Nov 19 '21 17:11 mifrost

Valid JSON by definition has quotes. Could you use key_value line_format instead?

l2dy avatar Dec 26 '21 14:12 l2dy

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.

github-actions[bot] avatar Mar 27 '22 02:03 github-actions[bot]

What is necessary to accept this PR?

The PR would help to prevent the needless quotes escape (\").

tsk9 avatar Apr 22 '24 13:04 tsk9

In my opinion, a new option should be introduced instead of breaking the existing behavior that conforms to line_format.

l2dy avatar Apr 22 '24 14:04 l2dy

Something like a drop_single_key_as_raw_value configuration option?

tsk9 avatar Apr 22 '24 15:04 tsk9

Something like a drop_single_key_as_raw_value configuration 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.

l2dy avatar Apr 22 '24 16:04 l2dy

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.

github-actions[bot] avatar Jul 23 '24 01:07 github-actions[bot]