-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Vector Version
vector 0.13.1 (v0.13.1 x86_64-pc-windows-msvc 2021-04-29)
Vector Configuration File
I don't think anything in the configuration is relevant, but just in case:
https://gist.github.com/mmelvin0/d2d532ad3b13907753f6a6db781a4047
The above is a working configuration file. To reproduce the error, introduce any Vector Remap Language compile-time error.
Debug Output
The color escapes can be seen in the debug output:
https://gist.github.com/mmelvin0/481ad49544e141203e4ca1aa86c200b8
Expected Behavior
To be able to easily read Vector's JSON log output when running as:
vector -vvv --color=never --log-format=json --config=vector.toml
Actual Behavior
JSON logs about configuration errors are difficult to read because they contain embedded color escape sequences.
Example Data
{"timestamp":"May 23 12:33:31.021","level":"ERROR","message":"Configuration error.","error":"Transform \"remap_fluentbit\": \n\u001b[0m\u001b[1m\u001b[38;5;9merror[E651]\u001b[0m\u001b[1m: unnecessary error coalescing operation\u001b[0m\n \u001b[0m\u001b[36m┌─\u001b[0m :8:4\n \u001b[0m\u001b[36m│\u001b[0m\n\u001b[0m\u001b[36m8\u001b[0m \u001b[0m\u001b[36m│\u001b[0m if \u001b[0m\u001b[31mparts.lvl != null\u001b[0m ?? false {\n \u001b[0m\u001b[36m│\u001b[0m \u001b[0m\u001b[31m^^^^^^^^^^^^^^^^^\u001b[0m \u001b[0m\u001b[36m--\u001b[0m \u001b[0m\u001b[36m-----\u001b[0m \u001b[0m\u001b[36mthis expression never resolves\u001b[0m\n \u001b[0m\u001b[36m│\u001b[0m \u001b[0m\u001b[31m│\u001b[0m \u001b[0m\u001b[36m│\u001b[0m\n \u001b[0m\u001b[36m│\u001b[0m \u001b[0m\u001b[31m│\u001b[0m \u001b[0m\u001b[36mremove this error coalescing operation\u001b[0m\n \u001b[0m\u001b[36m│\u001b[0m \u001b[0m\u001b[31mthis expression can't fail\u001b[0m\n \u001b[0m\u001b[36m│\u001b[0m\n \u001b[0m\u001b[36m=\u001b[0m see language documentation at https://vrl.dev\n","target":"vector::topology"}Additional Context
I'm running Vector on Windows 10 as a service under NSSM. My use case is to be able to read the JSON log in case of a configuration error in vector.yaml when I restart the service. I'd like to avoid popping open PowerShell to debug Vector configuration.
References
The --color CLI argument was originally added in #599.
Arguably JSON output should never contain color escape sequences, even if the output is a terminal.