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
release-23.1: log: add buffer format options #104790
release-23.1: log: add buffer format options #104790
Conversation
This commit adds an option to format the logging sink buffers on flush. New option (under `buffering` in the config file): - format: string that is either 'json-array' or 'newline', defaulting to 'newline'. Format options: - json-array: adds '[' at the start of the buffer output and ']' at the end. Separates entries in the buffer with ",". - newline (default): separates entries in the buffer with "\n". This change was motivated by the desire to be able to send batched logs to the Datadog API, which expects them to be in a JSON array when multiple logs are present. Note that If buffering is off, it is still valid to send a single JSON log to the Datadog logs API. Part of: #103477 Release note (cli change): New log config option for the `buffering` field to allow buffer output to formatted as JSON arrays. This can be useful for APIs requring json array format, such as the Datadog logs API. New fields: - format: 'json-array' or 'newline'. Descriptions: - json-array: adds '[' at the start of the buffer output and ']' at the end. Separates entries in the buffer with ",". - newline (default): separates entries in the buffer with "\n".
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
c5bf34b
to
bcfeaf6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 10 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @xinhaoz)
Backport 1/1 commits from #103463 on behalf of @xinhaoz.
/cc @cockroachdb/release
This commit adds an option to format the logging sink
buffers on flush.
New option (under
buffering
in the config file):defaulting to 'newline'.
Format options:
at the end. Separates entries in the buffer with ",".
This change was motivated by the desire to be able to send batched logs
to the Datadog API, which expects them to be in a JSON array when multiple
logs are present. Note that If buffering is off, it is still valid to
send a single JSON log to the Datadog logs API.
Part of: #103477
Release note (cli change): New log config option for the
buffering
field to allow buffer output to formatted asJSON arrays. This can be useful for APIs requring json array
format, such as the Datadog logs API.
New fields:
Descriptions:
at the end. Separates entries in the buffer with ",".
Release justification: high priority need for feature