logger: Add command line option to escape c-style escape sequences in application logs (#8672)
Currently, application logs are not sanitized of c-style escape sequences. If any filter logs a message that contains newline characters, the logs will be printed to a new line. This breaks log formats set by the --log-format option, breaking integration with log viewers. This change adds a command line option --log-format-escaped to escape c-style escape characters in application logs before they are outputted. Enabling this flag ensures newline characters in logs are ignored, meaning that each call to ENVOY_LOG will result in at most 1 line outputted. This flag works for both Stderr and File loggers. Risk Level: Low Testing: Unit tests Fuzz test Manual verification (see comments in PR) Performance Impact: As long as production environments are running with the default log level, this will only slightly impact startup time (only when --log-format-escaped is set). The critical section for each request/response will not be impacted. Docs Changes: Added docs to command line options about new flag and possible use cases, like Stackdriver Logging integration on GKE. Release Notes: Added release notes about new flag Fixes #8637 Signed-off-by: Teju Nareddy <nareddyt@google.com> Mirrored from https://github.com/envoyproxy/envoy @ 20ca0ae3bdd9c2a69194203f5e1d2eca92ce2b48master-ci-test
parent
9c76d78795
commit
42dcb6bae9
2 changed files with 8 additions and 2 deletions
Loading…
Reference in new issue