influxdb/logfmt
Marko Mikulicic c18e3c462f
fix: Escape non-printable characters in logfmt
The is no specification logfmt, most implementations only unescape `\"` and leave
`\n` as is when parsing. Some implementations like go-logfmt do escape newlines as `\n` (and other chars
according to Go's escaping rules).

This PR just escapes non-printable characters using rust's string literal rules; they are not perfect but
they don't seem to be worse than other players.

(If this bites us some more we will probably be better of switching to json log output format and then equip ourselves with some simple shell scripts to reformat the logs on the fly while we're streaming them from k8s)

As a bonus point, this effectively simplifies the escaping code, possibly also speeding it up a bit
since it doesn't have to call replace twice (although I don't know what magic would the rust compiler have done to this double replace).

Closes #1791
Closes influxdata/k8s-iox#1
2021-06-23 17:57:00 +02:00
..
src fix: Escape non-printable characters in logfmt 2021-06-23 17:57:00 +02:00
tests fix: Fix logfmt escaping 2021-06-04 02:10:24 +02:00
Cargo.toml chore: rename tracing_deps to observability_deps 2021-04-02 13:14:30 -07:00