-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[server/logging] Allow opting out of UTC #14705
[server/logging] Allow opting out of UTC #14705
Conversation
src/server/logging/log_format.js
Outdated
@@ -46,10 +46,19 @@ export default class TransformObjStream extends Stream.Transform { | |||
next(); | |||
} | |||
|
|||
formatTimestamp(data, format) { |
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.
nit/question: is there any reason that prevents you from passing just @timestamp
field instead of entire data
object. Currently this method has potential access to the info that it shouldn't have + IMO with this method signature it looks more like extractAndFormatTimestamp
:)
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.
I really don't like assuming that the "data" has a @timestamp
property, which is why formatTimestamp does the property access, it is defined in the same place as the original @timestamp
property is defined. Switched the method to extractAndFormatTimestamp()
]); | ||
|
||
const { '@timestamp': timestamp } = JSON.parse(result); | ||
expect(timestamp).to.eql(moment.utc(time).format()); |
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.
optional nit: we can use to.be
here and below to be even more "stricter" :)
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.
LGTM, just two nits.
* [server/logging] make use of UTC configurable * [server/logging/tests] try removing TZ from moment * [server/log/formatJson] use strict equality checks * [server/log/format] note in method name that time is extracted (cherry picked from commit b79ba98)
6.x/6.1: abab9fc |
YES @spalger!!! 🍻 🥂 🎆 |
Closes #8499
Rather than always use UTC the timestamps in the log, this adds the
logging.useUTC
config option, which defaults totrue
(until we get to #12175)