-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Update iso timestamp to include timezone #17706
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
base: main
Are you sure you want to change the base?
Conversation
This changes the timestamp into a format, which includes the timezone. This will make it easier for all applications who read the logs to place it correctly without haveing to guess that this is UTC. Support for this format is documented here: https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.FixedFormat.html
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
This pull request does not have a backport label. Could you fix it @ash-darin? 🙏
|
I'd love to but I am not authorized apparently. Yes, a backport to 8.x would be nice. |
enhancement
This changes the timestamp for log4j logging into a format, which includes the timezone. This will make it easier for all applications who read the logs to place it correctly without having to guess that this is UTC. Support for this format is documented here:
https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.FixedFormat.html
This should not break compatibility as the Format is still ISO8601 conforming.
This fixes: #10238
Release notes
Change timestamp in logging to include timezone. Fixes #10238
What does this PR do?
This changes the exposed timestamp in the logstash logs from an ISO timestamp without timezone information to a timestamp with timezone information.
Example:
[2025-06-11T12:14:57,812][INFO ][logstash.agent ] Pipelines running
`
becomes:
[2025-06-11T12:14:57,812+00:00][INFO ][logstash.agent ] Pipelines running
`
The format and setting is explained here:
https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.FixedFormat.html#ISO8601_OFFSET_DATE_TIME_HHCMM
Note: This is also the timestamp format that kibana uses:
[2025-06-11T15:51:07.413+00:00][INFO ][plugins.actions.server-log]`
Why is it important/What is the impact to the user?
This change allows programs that ingest the logs to correctly autodetect the timezone without having to just assume "UTC" as many programs assume local time without a timezone identifier, see also here:
If no UTC relation information is given with a time representation, the time is assumed to be in local time.
https://en.wikipedia.org/wiki/ISO_8601#Local_time_(unqualified)
Both the old and the new timestamp are ISO8601 format timestrings and all programms supporting ISO8601 parsing should read and interpret the new format automatically.
Checklist