-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
x-pack/filebeat/input/httpjson: Fix parseDate location offset #37738
x-pack/filebeat/input/httpjson: Fix parseDate location offset #37738
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
This pull request is now in conflicts. Could you fix it? 🙏
|
2827495
to
b740082
Compare
b740082
to
5788345
Compare
❕ Build Aborted
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
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'm not convinced that this is the right solution. If we cannot parse the timezone because it is incorrectly using a non-IANA tzdb label or absolute fixed timezone, it should be set in the UI config.
@efd6 thanks for taking a look! Since this is fixing a value template, that parses dates that can come from anywhere at any timezone, how would we set the timezone in the UI config? Do you mean forcing users that use this value template to define what's the timezone of the incoming dates? On the other hand, do you see any particular issue that makes this change undesirable? I agree this may not be the optimal solution, even the Go developers seem to have been debating the issue for quite some time: Please let me know your thoughts about this. Thanks! |
The commentary in go.dev/issue/63345 goes over the issues with this very nicely and explains exactly why this is undesirable. The caveat in the final paragraph of In practice any particular instance of HTTPJSON would likely only be collecting data from a single tz, so if this is not parseable, a single configuration location would be enough to specify that time be handled in that singular location. Maybe it would be helpful to have a If this change here is added, it needs documentation making the sharp edges clear and suggesting that users configure time-offset timezone specs if possible. |
This pull request is now in conflicts. Could you fix it? 🙏
|
1 similar comment
This pull request is now in conflicts. Could you fix it? 🙏
|
5788345
to
b767c90
Compare
💚 Build Succeeded
|
💚 Build Succeeded
|
💚 Build Succeeded
|
💚 Build Succeeded
|
@efd6 I added a new value template
I chose the last option, let me know if you have second thoughts on this. |
💚 Build Succeeded
|
💚 Build Succeeded
|
I agree. |
Add a new value template helper `parseDateInTZ` where users can apply the proper timezone when parsing dates, avoiding the limitations of `parseDate` with timezone abbreviations. It accepts numeric offsets and IANA time zone names. (cherry picked from commit 8214f9f)
… location offset (#38085) * x-pack/filebeat/input/httpjson: Fix parseDate location offset (#37738) Add a new value template helper `parseDateInTZ` where users can apply the proper timezone when parsing dates, avoiding the limitations of `parseDate` with timezone abbreviations. It accepts numeric offsets and IANA time zone names. (cherry picked from commit 8214f9f) * Fix changelog --------- Co-authored-by: Chema Martínez <chema.martinez@elastic.co>
Proposed commit message
We encountered an issue from an SDH due to how the
time.Parse
function in Go handles timezone abbreviations. It interprets them based on the server's local time zone, which can lead to incorrect conversions if the server's local time zone doesn't match the time zone abbreviation in the string.Since this is a limitation of the
time.Parse
function, we decided to add a new helperparseDateInTZ
where users can apply the proper timezone when parsing dates. It accepts numeric offsets and IANA time zone names.Checklist
I have commented my code, particularly in hard-to-understand areasI have made corresponding changes to the documentationI have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.