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)


20
21
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
# File 'lib/logstash/pipeline.rb', line 20

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.



18
19
20
# File 'lib/logstash/pipeline.rb', line 18

def filters
  @filters
end

#inputsObject (readonly)

Returns the value of attribute inputs.



18
19
20
# File 'lib/logstash/pipeline.rb', line 18

def inputs
  @inputs
end

#outputsObject (readonly)

Returns the value of attribute outputs.



18
19
20
# File 'lib/logstash/pipeline.rb', line 18

def outputs
  @outputs
end

Instance Method Details

#non_reloadable_pluginsObject



63
64
65
# File 'lib/logstash/pipeline.rb', line 63

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

#reloadable?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/logstash/pipeline.rb', line 55

def reloadable?
  configured_as_reloadable? && reloadable_plugins?
end

#reloadable_plugins?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/logstash/pipeline.rb', line 59

def reloadable_plugins?
  non_reloadable_plugins.empty?
end