diff options
author | Will Chandler <wchandler@gitlab.com> | 2020-03-05 23:27:00 +0300 |
---|---|---|
committer | jramsay <wchandler@gitlab.com> | 2020-03-05 23:46:34 +0300 |
commit | b85abefd6757ed81aee7222e5ccb8f9f77c70c31 (patch) | |
tree | 66f1d0d187dc2524152e6df9c5de9f3f05685c79 | |
parent | 7f89a20fe54eda0fbdd75e78bf58548b87a71485 (diff) |
Use millisecond precision for JSON time field
Updates the `time` field in JSON formatted logs to use millisecond
precision. Currently second precision is used, but more granularity
is useful with high transaction volume. This will bring Gitaly in
line with the precision used in the rails JSON logs.
For comparison, Gitaly non-JSON logs list the time with 10-microsecond
precision at the start of the line, followed by a `time` field
that uses second precision:
2019-10-04_18:55:54.73359 time="2019-10-04T18:55:54Z
-rw-r--r-- | changelogs/unreleased/wc-json-log-time-fmt.yml | 5 | ||||
-rw-r--r-- | internal/log/log.go | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/changelogs/unreleased/wc-json-log-time-fmt.yml b/changelogs/unreleased/wc-json-log-time-fmt.yml new file mode 100644 index 000000000..34e134710 --- /dev/null +++ b/changelogs/unreleased/wc-json-log-time-fmt.yml @@ -0,0 +1,5 @@ +--- +title: Use millisecond precision for time in JSON logs +merge_request: +author: +type: changed diff --git a/internal/log/log.go b/internal/log/log.go index e1d565d45..61e0f036e 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -30,7 +30,7 @@ func Configure(format string, level string) { switch format { case "json": for _, l := range Loggers { - l.Formatter = &logrus.JSONFormatter{} + l.Formatter = &logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.999Z"} } case "": // Just stick with the default |