-
Notifications
You must be signed in to change notification settings - Fork 467
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
PR #104265 - util/log: MVP of customizable 'datetime' field for JSON output #17266
Comments
Tommy Truongchau (thtruo) commented: this enhancement is part of the 23.2 release, and should be documented before that release as it’s part of a customer commit with Fidelity giving them a way to set timezones for logsthat this PR touches multiple DOC issues (so perhaps for ease of tracking, either we move all these issues into the same sprint, or close out the rest while keeping this issue as the tracking item - will defer to you the best way to manage it from the docs perspective):https://cockroachlabs.atlassian.net/browse/DOC-8098 https://cockroachlabs.atlassian.net/browse/DOC-8099 https://cockroachlabs.atlassian.net/browse/DOC-8100 https://cockroachlabs.atlassian.net/browse/DOC-8101 https://cockroachlabs.atlassian.net/browse/DOC-8102 |
Florence Morris (florence-crl) commented: Alex Barganier {quote}Aha! Definitely a bug.Despite saying that it's {{format: json}} - it's using {{format: crdb-v2}}! Because it's confusing the formats, it's using the wrong parser (the crdb-v2 one) when trying to interpret the format options. Of course, {{datetime-format}} isn't supported in crdb-v2, so it gives up and errors out.Glad you brought this to our attention! I'll work on a fix. Thanks Florence{quote} |
Florence Morris (florence-crl) commented: |
Florence Morris (florence-crl) commented: PR backported to 23.2: cockroachdb/cockroach#113684 |
Exalate commented:
Related PR: cockroachdb/cockroach#104265
Commit: cockroachdb/cockroach@56da2cb
Fixes: CRDB-5594 CRDB-19901
Release note (cli change): The configuration for log output sinks now
accepts a new
format-options
field. This can be used to customizethe output of a given format. Each format accepts different options.
One available option for the
json
output format isdatetime-format
. For example:This introduces a (new) field
datetime
in each output JSON event,with the format specified by the option. As of this writing, the
following values are documented:
none
: disable the creation of thedatetime
field.This is the default value.
iso8601
/rfc3339
: format the time stamp like"2006-01-02T15:04:05.999999999Z".
rfc1123
: format the time stamp like "Mon, 02 Jan 2006 15:04:05 +0000".Note that enabling the
datetime
field introduces CPU overheadand is nearly always unnecessary. When using output to a log
collector (e.g. via Fluent, Datadog etc) the log collector can
be configured to transform the timestamp provided by CockroachDB,
without requiring participation from CockroachDB itself. When
inspecting a log file containing JSON output produced by CockroachDB,
the command
cockroach debug merge-log
can be used to consume theJSON data and reformat it using the
crdb-v2
format which alsoincludes the date/time using the RFC3339 format.
Jira Issue: DOC-8095
The text was updated successfully, but these errors were encountered: