-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
util/log: MVP of customizable 'datetime' field for JSON output
As of this commit, only the "full JSON" format (with format name `json`) recognizes the new option. In addition to the formats documented below, an operator can use `fmt:XXXX` to customize the output exactly using the Go time formatting string `XXXX`. This is introduced as an "escape hatch" if the pre-defined formats are found insufficient. Release note (cli change): The configuration for log output sinks now accepts a new `format-options` field. This can be used to customize the output of a given format. Each format accepts different options. One available option for the `json` output format is `datetime-format`. For example: ```yaml sinks: fluent-groups: custom-json: format: json format-options: {datetime-format: rfc3339} ``` 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 the `datetime` 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 overhead and 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 the JSON data and reformat it using the `crdb-v2` format which also includes the date/time using the RFC3339 format.
- Loading branch information
Showing
5 changed files
with
81 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters