Class: LogStash::Config::PipelineConfig
- Inherits:
-
Object
- Object
- LogStash::Config::PipelineConfig
- Includes:
- Util::Loggable
- Defined in:
- lib/logstash/config/pipeline_config.rb
Instance Attribute Summary collapse
-
#config_parts ⇒ Object
readonly
Returns the value of attribute config_parts.
-
#pipeline_id ⇒ Object
readonly
Returns the value of attribute pipeline_id.
-
#read_at ⇒ Object
readonly
Returns the value of attribute read_at.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #config_hash ⇒ Object
- #config_string ⇒ Object
- #display_debug_information ⇒ Object
-
#initialize(source, pipeline_id, config_parts, settings) ⇒ PipelineConfig
constructor
A new instance of PipelineConfig.
- #system? ⇒ Boolean
Constructor Details
#initialize(source, pipeline_id, config_parts, settings) ⇒ PipelineConfig
Returns a new instance of PipelineConfig.
10 11 12 13 14 15 16 17 18 |
# File 'lib/logstash/config/pipeline_config.rb', line 10 def initialize(source, pipeline_id, config_parts, settings) @source = source @pipeline_id = pipeline_id # We can't use Array() since config_parts may be a java object! config_parts_array = config_parts.is_a?(Array) ? config_parts : [config_parts] @config_parts = config_parts_array.sort_by { |config_part| [config_part.protocol.to_s, config_part.id] } @settings = settings @read_at = Time.now end |
Instance Attribute Details
#config_parts ⇒ Object (readonly)
Returns the value of attribute config_parts.
8 9 10 |
# File 'lib/logstash/config/pipeline_config.rb', line 8 def config_parts @config_parts end |
#pipeline_id ⇒ Object (readonly)
Returns the value of attribute pipeline_id.
8 9 10 |
# File 'lib/logstash/config/pipeline_config.rb', line 8 def pipeline_id @pipeline_id end |
#read_at ⇒ Object (readonly)
Returns the value of attribute read_at.
8 9 10 |
# File 'lib/logstash/config/pipeline_config.rb', line 8 def read_at @read_at end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
8 9 10 |
# File 'lib/logstash/config/pipeline_config.rb', line 8 def settings @settings end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/logstash/config/pipeline_config.rb', line 8 def source @source end |
Instance Method Details
#==(other) ⇒ Object
32 33 34 |
# File 'lib/logstash/config/pipeline_config.rb', line 32 def ==(other) config_hash == other.config_hash && pipeline_id == other.pipeline_id && settings == other.settings end |
#config_hash ⇒ Object
20 21 22 |
# File 'lib/logstash/config/pipeline_config.rb', line 20 def config_hash @config_hash ||= Digest::SHA1.hexdigest(config_string) end |
#config_string ⇒ Object
24 25 26 |
# File 'lib/logstash/config/pipeline_config.rb', line 24 def config_string @config_string = config_parts.collect(&:text).join("\n") end |
#display_debug_information ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/logstash/config/pipeline_config.rb', line 36 def display_debug_information logger.debug("-------- Logstash Config ---------") logger.debug("Config from source", :source => source, :pipeline_id => pipeline_id) config_parts.each do |config_part| logger.debug("Config string", :protocol => config_part.protocol, :id => config_part.id) logger.debug("\n\n#{config_part.text}") end logger.debug("Merged config") logger.debug("\n\n#{config_string}") end |
#system? ⇒ Boolean
28 29 30 |
# File 'lib/logstash/config/pipeline_config.rb', line 28 def system? @settings.get("pipeline.system") end |