logfmt icon indicating copy to clipboard operation
logfmt copied to clipboard

feat: replace invisible control characters in keys with "_"

Open spaceone opened this issue 2 months ago • 0 comments

Control chars in keys are currently completely removed.

That causes that foo\x12bar appears equally to foobar in the logline. A log reader (developer) also doesn't recognize that something "wrong" or "broken" or "dangerous" has been tried to log.

Therefor I would propose to replace these control chars with _ (or the unicode equivalent escape sequence, but that looks dirty). The case when this happens in real world is probably under 0.9%.

Python-logfmter would like to have a equal behavior than this project: https://github.com/josheppinette/python-logfmter/issues/54

spaceone avatar Oct 13 '25 10:10 spaceone