-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
structured logging: better support for multi-line strings #106262
Comments
When adding something like this, #106262 can be reverted and implemented differently. |
My original thinking was that only objects that explicitly ask for multi-line output get formatted that way. But that means that we need to review log calls very carefully. An alternative is to automatically switch from quoting strings to multi-line output based on some heuristic, for example when there's more than one line break. |
Here's a potential implementation: kubernetes/klog#268 |
@pohly If structured logging is needed in any other case I can contribute, please inform if needed. |
/triage accepted /cc @serathius |
We have the same problem as in kube-scheduler also in kubelet, it's just that no-one has seen and/or complained about the multi-line strings. With the benchmark + log analysis tool from #106594 I found the following multi-line string parameters in a kubelet log:
|
What would you like to be added?
When using
InfoS
orErrorS
with a key/value that has a multi-line string as value, that value will appear as quoted string in the log message, i.e. the log message will still be a single line.It would be nicer to print the value in text mode so that it goes across multiple lines, with clear indicators for start and end of the value. Indention could be used to avoid mistaking some embedded line as the start of a new log message.
In JSON mode, the value should be formatted normally.
/sig instrumentation
/wg structured-logging
Why is this needed?
Always printing as a single line can can make the log output unreadable (#104868).
The text was updated successfully, but these errors were encountered: