awslabs / flowgger

A fast data collector in Rust
BSD 2-Clause "Simplified" License
834 stars 55 forks source link

LTSV decoder doesn't respect output.ltsv_extra add or replace fields #39

Open kurojishi opened 5 years ago

kurojishi commented 5 years ago

Found this while writing tests

As for https://github.com/jedisct1/flowgger/wiki/LTSV-Encoder the encoders should support the ability to add or replace, without duplicating tags and fields.

LTSV is not only not overriding it, but get duplicated as the encoding is done by appending data to a String:

https://github.com/awslabs/flowgger/blob/master/src/flowgger/encoder/ltsv_encoder.rs#L41

left: "some_info:foo\tsome_info:bar\thost:example.org\ttime:1385053862.3072\tmessage:A short message\tfull_message:Backtrace here with more\tlevel:1\tappname:appname\tprocid:44\tmsgid:msg_id", right: "some_info:bar\thost:example.org\ttime:1385053862.3072\tmessage:A short message\tfull_message:Backtrace here with more\tlevel:1\tappname:appname\tprocid:44\tmsgid:msg_id"', src/flowgger/encoder/ltsv_encoder.rs:175:9