Class: LogStash::Config::Source::Modules

Inherits:
Base
  • Object
show all
Includes:
Util::Loggable
Defined in:
lib/logstash/config/source/modules.rb

Instance Attribute Summary

Attributes inherited from Base

#conflict_messages

Instance Method Summary collapse

Methods inherited from Base

#both_module_configs?, #config_path, #config_path?, #config_path_setting, #config_reload_automatic, #config_reload_automatic?, #config_reload_automatic_setting, #config_string, #config_string?, #config_string_setting, #initialize, #modules, #modules?, #modules_cli, #modules_cli?, #modules_cli_setting, #modules_defined?, #modules_setting

Constructor Details

This class inherits a constructor from LogStash::Config::Source::Base

Instance Method Details

#config_conflict?Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/logstash/config/source/modules.rb', line 27

def config_conflict?
  @conflict_messages.clear
  # Make note that if modules are configured in both cli and logstash.yml that cli module
  # settings will overwrite the logstash.yml modules settings
  if modules_cli? && modules?
    logger.info(I18n.t("logstash.runner.cli-module-override"))
  end

  if automatic_reload_with_modules?
    @conflict_messages << I18n.t("logstash.runner.reload-with-modules")
  end

  # Check if config (-f or -e) and modules are configured
  if (modules_cli? || modules?) && (config_string? || config_path?)
    @conflict_messages << I18n.t("logstash.runner.config-module-exclusive")
  end

  @conflict_messages.any?
end

#match?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/logstash/config/source/modules.rb', line 22

def match?
  # see basic settings predicates and getters defined in the base class
  (modules_cli? || modules?) && !(config_string? || config_path?) && !automatic_reload_with_modules?
end

#pipeline_configsObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/logstash/config/source/modules.rb', line 9

def pipeline_configs
  if config_conflict? # double check
    raise ConfigurationError, @conflict_messages.join(", ")
  end

  pipelines = LogStash::Config::ModulesCommon.pipeline_configs(@settings)
  pipelines.map do |hash|
    PipelineConfig.new(self, hash["pipeline_id"].to_sym,
      org.logstash.common.SourceWithMetadata.new("module", hash["alt_name"], 0, 0, hash["config_string"]),
      hash["settings"])
  end
end