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

ECS Compatibility - backport 7x #12308

Merged
merged 1 commit into from
Oct 6, 2020

Conversation

yaauie
Copy link
Member

@yaauie yaauie commented Oct 6, 2020

What does this PR do?

This PR is a clean backport of #12305 to 7.x:

Implements a plugin ecs_compatibility option, whose default value is powered
by the pipeline-level setting pipeline.ecs_compatibility, in line with the
proposal in #11623:

In order to increase the confidence a user has when upgrading Logstash, this
implementation uses the deprecation logger to warn when ecs_compatibility is
used without an explicit directive.

For now, as we continue to add ECS Compatibility Modes, an opting into a
specific ECS Compatibility mode at a pipeline level is considered a BETA
feature. All plugins using the ECS Compatibility Support adapter will
use the setting correctly, but pipelines configured in this way do not
guarantee consistent behaviour across minor versions of Logstash or the
plugins it bundles (e.g., upgraded plugins that have newly-implemented an ECS
Compatibility mode will use the pipeline-level setting as a default, causing
them to potentially behave differently after the upgrade).

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

This is a part of an ongoing effort to add ECS Compatibility modes to Logstash plugins (#11635), and to have them on-by-default in the next major release of Logstash (#11623). The newly-introduced pipeline.ecs_compatibility allows a user to explicitly control the default behaviour of all plugins in a pipeline.

This allows a user on Logstash 7.last to "lock in" a specific behaviour in advance of upgrading to Logstash 8.

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

How to test this PR locally

The only plugin with ECS Compatibility that is currently shipped is the Elasticsearch Output, whose behaviour is changed to use ECS-compatibile index templates. Configure a pipeline that uses it, and run Logstash with --pipeline.ecs_compatibility=v1 set (command line) or pipeline.ecs_compatibility: v1 (config, either logstash.yml or under a specific pipeline in pipelines.yml). Observe ECS-compatible templates being sent to Elasticsearch at startup.

@yaauie yaauie changed the base branch from master to 7.x October 6, 2020 14:14
@cla-checker-service
Copy link

cla-checker-service bot commented Oct 6, 2020

💚 CLA has been signed

Implements a plugin `ecs_compatibility` option, whose default value is powered
by the pipeline-level setting `pipeline.ecs_compatibility`, in line with the
proposal in elastic#11623:

In order to increase the confidence a user has when upgrading Logstash, this
implementation uses the deprecation logger to warn when `ecs_compatibility` is
used without an explicit directive.

For now, as we continue to add ECS Compatibility Modes, an opting into a
specific ECS Compatibility mode at a pipeline level is considered a BETA
feature. All plugins using the [ECS Compatibility Support][] adapter will
use the setting correctly, but pipelines configured in this way do not
guarantee consistent behaviour across minor versions of Logstash or the
plugins it bundles (e.g., upgraded plugins that have newly-implemented an ECS
Compatibility mode will use the pipeline-level setting as a default, causing
them to potentially behave differently after the upgrade).

This change-set also includes a significant amount of work within the
`PluginFactory`, which allows us to ensure that pipeline-level settings are
available to a Logstash plugin _before_ its `initialize` is executed,
including the maintaining of context for codecs that are routinely cloned.

* JEE: instantiate codecs only once
* PluginFactory: use passed FilterDelegator class
* PluginFactory: require engine name in init
* NOOP: remove useless secondary plugin factory interface
* PluginFactory: simplify, compute java args only when necessary
* PluginFactory: accept explicit id when vertex unavailable
* PluginFactory: make source optional, args required
* PluginFactory: threadsafe refactor of id duplicate tracking
* PluginFactory: make id extraction/geration more abstract/understandable
* PluginFactory: extract or generate ID when source not available
* PluginFactory: inject ExecutionContext before initializing plugins
* Codec: propagate execution_context and metric to clones
* Plugin: intercept string-specified codecs and propagate execution_context
* Plugin: implement `ecs_compatibility` for all plugins
* Plugin: deprecate use of `Config::Mixin::DSL::validate_value(String, :codec)`
@yaauie yaauie force-pushed the ecs_compatibility_backport_7x branch from ba73478 to e11b6d3 Compare October 6, 2020 14:15
@yaauie
Copy link
Member Author

yaauie commented Oct 6, 2020

jenkins test this again please

Copy link
Contributor

@kares kares left a comment

Choose a reason for hiding this comment

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

🍏

@yaauie yaauie merged commit c606e9f into elastic:7.x Oct 6, 2020
@yaauie yaauie deleted the ecs_compatibility_backport_7x branch October 6, 2020 15:33
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