Skip to content
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

Add troubleshooting section for the date filter #16549

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

robbavey
Copy link
Member

Relates: #16530


** Mitigations**

* Change the locale in the date filter to a locale that still uses `Sep` as the abbreviated form for September, such as `en_US`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Can it be changed by using the ENV vars like https://www.baeldung.com/linux/locale-environment-variables ?

** Mitigations**

* Change the locale in the date filter to a locale that still uses `Sep` as the abbreviated form for September, such as `en_US`.
* Switch out the locale provider from CLDR to compat by setting `-Djava.locale.providers=COMPAT,SPI` in `jvm.options`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option needs to be protected with a "Only for JDK < 23"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logstash only supports 11, 17 and 21.

@lucabelluccini
Copy link
Contributor

Thank you @robbavey for this!

Can you confirm those QA below are valid? If they are, I would like to write some suggestions on top of what you've drafted.

  1. As a user, do I have to check something before upgrading Logstash or JDK? If yes, in which situations I should pay attention?

The change can affect any Logstash user using JDK 17 or more recent.

According to the support matrix, it's possible to use JDK 17 in 7.16.x onwards.

So the "might be affected" users are those matching all the following conditions:

  • Using date parsing (using the date filter - or even ruby filters with Ruby date formats patterns) in Logstash pipelines
  • Locale (in the date filter, or in env vars of the Logstash process) is different from en_US
  • Running JDK >= 17 (respecting the supported Logstash versions in the support matrix)
  1. As a user, what can I do to not be affected by those changes?

As usual, all pipelines should be validated & tested by the user.

If you plan to use Logstash with JDK versions 17 or more recent, you have to apply one of the following:

  • (Only for JDK < 23) Switch the locale provider to -Djava.locale.providers=COMPAT,SPI. This will guarantee the behavior of the JVM will be the same as before this change.

  • Force the locale via the locale env variables to en_US (this will affect all Logstash plugin & core). Note: if a locale is specified at date plugin level, it will override the locale env variables

  • Force the locale via the date filter setting to en_US

  • Introduce a filter prior the date parsing filters to replace Sep occurrences into Sept

@robbavey
Copy link
Member Author

Thank you @robbavey for this!

Can you confirm those QA below are valid? If they are, I would like to write some suggestions on top of what you've drafted.

  1. As a user, do I have to check something before upgrading Logstash or JDK? If yes, in which situations I should pay attention?

The change can affect any Logstash user using JDK 17 or more recent.

According to the support matrix, it's possible to use JDK 17 in 7.16.x onwards.

So the "might be affected" users are those matching all the following conditions:

  • Using date parsing (using the date filter - or even ruby filters with Ruby date formats patterns) in Logstash pipelines
  • Locale (in the date filter, or in env vars of the Logstash process) is different from en_US

This makes sense - do you think it makes sense to mention that we know about the changes in en_gb and en_au, but others might be affected?

  • Running JDK >= 17 (respecting the supported Logstash versions in the support matrix)

It's actually JDK21 that has the issue - moving from JDK17 to JDK20 and above included a change to CLDR 42, which included the incompatible updates

  1. As a user, what can I do to not be affected by those changes?

As usual, all pipelines should be validated & tested by the user.

If you plan to use Logstash with JDK versions 17 or more recent, you have to apply one of the following:

This should be "versions 20 or more recent"

  • (Only for JDK < 23) Switch the locale provider to -Djava.locale.providers=COMPAT,SPI. This will guarantee the behavior of the JVM will be the same as before this change.
  • Force the locale via the locale env variables to en_US (this will affect all Logstash plugin & core). Note: if a locale is specified at date plugin level, it will override the locale env variables

Or a locale that matches the data being sent into logstash

  • Force the locale via the date filter setting to en_US
  • Introduce a filter prior the date parsing filters to replace Sep occurrences into Sept

docs/static/troubleshoot/ts-date.asciidoc Outdated Show resolved Hide resolved
docs/static/troubleshoot/ts-date.asciidoc Outdated Show resolved Hide resolved
** Mitigations**

* Change the locale in the date filter to a locale that still uses `Sep` as the abbreviated form for September, such as `en_US`.
* Switch out the locale provider from CLDR to compat by setting `-Djava.locale.providers=COMPAT,SPI` in `jvm.options`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logstash only supports 11, 17 and 21.

docs/static/troubleshoot/ts-date.asciidoc Outdated Show resolved Hide resolved
@lucabelluccini
Copy link
Contributor

This makes sense - do you think it makes sense to mention that we know about the changes in en_gb and en_au, but others might be affected?

Yes, we can say "we are aware that at least those are affected - other differences might also be present in other locales".

It's actually JDK21 that has the issue - moving from JDK17 to JDK20 and above included a change to CLDR 42, which included the incompatible updates

Ok - sorry for the misunderstanding - the problem is JDK >= 20. Anyway the support matrix only allows JDK 21 so we could mention JDK 20, but we also mention support matrix doesn't allow it.

think the rest of the text I've written should be amended with 17 -> 20/21.

Or a locale that matches the data being sent into Logstash

Yep, I can add it.

I've written a KB to dump the date formats, with the ability to switch of JDK version and pass the locale settings and default JDK locale provider preference at https://support.elastic.dev/knowledge/view/5028e60c. I wonder if it might be useful.

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants