Class: LogStash::BasePipeline

Inherits:
AbstractPipeline
  • Object
show all
Includes:
Util::Loggable
Defined in:
lib/logstash/pipeline.rb

Direct Known Subclasses

Pipeline

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pipeline_config, namespaced_metric = nil, agent = nil) ⇒ BasePipeline

Returns a new instance of BasePipeline.

Raises:

  • (ConfigurationError)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/logstash/pipeline.rb', line 22

def initialize(pipeline_config, namespaced_metric = nil, agent = nil)
  @logger = self.logger
  super pipeline_config, namespaced_metric, @logger

  @inputs = nil
  @filters = nil
  @outputs = nil
  @agent = agent

  @plugin_factory = LogStash::Plugins::PluginFactory.new(
    # use NullMetric if called in the BasePipeline context otherwise use the @metric value
    lir, LogStash::Plugins::PluginMetricFactory.new(pipeline_id, metric),
    LogStash::Plugins::ExecutionContextFactory.new(@agent, self, dlq_writer),
    FilterDelegator
  )
  grammar = LogStashConfigParser.new
  parsed_config = grammar.parse(config_str)
  raise(ConfigurationError, grammar.failure_reason) if parsed_config.nil?

  parsed_config.process_escape_sequences = settings.get_value("config.support_escapes")
  config_code = parsed_config.compile

  if settings.get_value("config.debug")
    @logger.debug("Compiled pipeline code", default_logging_keys(:code => config_code))
  end

  # Evaluate the config compiled code that will initialize all the plugins and define the
  # filter and output methods.
  begin
    eval(config_code)
  rescue => e
    raise e
  end
end

Instance Attribute Details

#filtersObject (readonly)

Returns the value of attribute filters.



20
21
22
# File 'lib/logstash/pipeline.rb', line 20

def filters
  @filters
end

#inputsObject (readonly)

Returns the value of attribute inputs.



20
21
22
# File 'lib/logstash/pipeline.rb', line 20

def inputs
  @inputs
end

#outputsObject (readonly)

Returns the value of attribute outputs.



20
21
22
# File 'lib/logstash/pipeline.rb', line 20

def outputs
  @outputs
end

Instance Method Details

#non_reloadable_pluginsObject



65
66
67
# File 'lib/logstash/pipeline.rb', line 65

def non_reloadable_plugins
  (inputs + filters + outputs).select { |plugin| !plugin.reloadable? }
end

#reloadable?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/logstash/pipeline.rb', line 57

def reloadable?
  configured_as_reloadable? && reloadable_plugins?
end

#reloadable_plugins?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/logstash/pipeline.rb', line 61

def reloadable_plugins?
  non_reloadable_plugins.empty?
end