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

Backport PR #16339 to 8.15: settings: add support for observing settings after post-process hooks #16348

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

github-actions[bot]
Copy link
Contributor

Backport PR #16339 to 8.15 branch, original message:


Because logging configuration occurs after loading the logstash.yml settings, deprecation logs from LogStash::Settings::DeprecatedAlias#set are effectively emitted to a null logger and lost.

By re-emitting these deprecations after the post-process hooks, we can ensure that they make their way to the deprecation log. This change adds support for any setting that responds to Object#observe_post_process to receive it after all post-processing hooks have been executed.

Release notes

Fixes an issue where the deprecation log does not contain entries related to providing deprecated settings by ensuring that they are re-emitted after the logger has been configured.

What does this PR do?

Fixes an issue where the deprecation log does not contain entries related to providing deprecated settings by ensuring that they are re-emitted after the logger has been configured.

Why is it important/What is the impact to the user?

Settings like http.enabled have been deprecated and superseded with other configuration since 7.x, but the deprecation log entries have been sent to the logger before it was configured, causing them to be lost. By re-emitting the deprecation warnings after the logger is configured we ensure that users have a chance to fix the issue and migrate to the new setting prior to the eventual removal of the deprecated ssettings.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • [ ]

How to test this PR locally

  1. run logstash with a deprecated setting
(echo 'http.enabled: false' > config/logstash.yml) && bin/logstash --log.level=debug -e 
'input { generator { count => 1 } }'
  1. observe the `logs/logstash-deprecation.log:
[2024-07-20T05:07:01,029][WARN ][deprecation.logstash.settings] The setting `http.enabled` is a deprecated alias for `api.enabled` and will be removed in a future release of Logstash. Please use api.enabled instead

Related issues

Resolves: #16332

…#16339)

Because logging configuration occurs after loading the `logstash.yml`
settings, deprecation logs from `LogStash::Settings::DeprecatedAlias#set` are
effectively emitted to a null logger and lost.

By re-emitting after the post-process hooks, we can ensure that they make
their way to the deprecation log. This change adds support for any setting
that responds to `Object#observe_post_process` to receive it after all
post-processing hooks have been executed.

Resolves: #16332
(cherry picked from commit c633ad2)
@jsvd jsvd merged commit 46b996c into 8.15 Jul 24, 2024
1 of 3 checks passed
@jsvd jsvd deleted the backport_16339_8.15 branch July 24, 2024 09:29
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

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