Module: LogStash::PluginMixins::ECSCompatibilitySupport

Defined in:
lib/logstash/plugin_mixins/ecs_compatibility_support.rb,
lib/logstash/plugin_mixins/ecs_compatibility_support/selector.rb,
lib/logstash/plugin_mixins/ecs_compatibility_support/spec_helper.rb,
lib/logstash/plugin_mixins/ecs_compatibility_support/target_check.rb

Overview

This ‘ECSCompatibilitySupport` can be included in any `LogStash::Plugin`, and will ensure that the plugin provides an `ecs_compatibility` option that accepts the literal `disabled` or a v-prefixed integer representing a major version of ECS (e.g., `v1`).

When included into a Logstash plugin that already has the option (e.g., when run on a Logstash release that includes this option on all plugins), this adapter will NOT override the existing implementation.

Defined Under Namespace

Modules: LegacyAdapter, SpecHelper, TargetCheck Classes: Selector

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This ‘ECSCompatibilitySupport` cannot be extended into an existing object.

Parameters:

  • base (Object)

Raises:

  • (ArgumentError)


38
39
40
# File 'lib/logstash/plugin_mixins/ecs_compatibility_support.rb', line 38

def self.extended(base)
  fail(ArgumentError, "`#{self}` cannot be extended into an existing object.")
end

.included(base) ⇒ void

This method returns an undefined value.

Parameters:

  • base (Class)

    : a class that inherits ‘LogStash::Plugin`, typically one descending from one of the four plugin base classes (e.g., `LogStash::Inputs::Base`)



24
25
26
27
28
29
30
# File 'lib/logstash/plugin_mixins/ecs_compatibility_support.rb', line 24

def self.included(base)
  fail(ArgumentError, "`#{base}` must inherit LogStash::Plugin") unless base < LogStash::Plugin

  # If our base does not include an `ecs_compatibility` config option,
  # include the legacy adapter to ensure it gets defined.      
  base.send(:include, LegacyAdapter) unless base.method_defined?(:ecs_compatibility)
end