Class: LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Config

Inherits:
Node
  • Object
show all
Includes:
Helpers
Defined in:
lib/logstash/compiler/lscl.rb

Constant Summary

Constants included from Helpers

Helpers::AND_METHOD, Helpers::BOOLEAN_DSL_METHOD_SIGNATURE, Helpers::NAND_METHOD, Helpers::OR_METHOD, Helpers::XOR_METHOD

Instance Method Summary collapse

Methods included from Helpers

#base_id, #base_protocol, #base_source_with_metadata, #base_source_with_metadata=, #compose, #compose_for, #jdsl, jdsl, #line_and_column, #source_meta

Methods inherited from Node

#section_type

Instance Method Details

#compile(base_source_with_metadata = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/logstash/compiler/lscl.rb', line 34

def compile(=nil)
  # There is no way to move vars across nodes in treetop :(
  self. = 

  sections = recursive_select(PluginSection)

  section_map = {
    :input  => [],
    :filter => [],
    :output => []
  }

  sections.each do |section|
    section_name = section.plugin_type.text_value.to_sym
    section_expr = section.expr
    raise "Unknown section name #{section_name}!" if ![:input, :output, :filter].include?(section_name)
    ::Array[section_expr].each do |se|
      section_map[section_name].concat se
    end
  end

  compiled_section_map = {}
  section_map.keys.each do |key|
    compiled_section_map[key] = compose_for(key).call(*section_map[key])
  end

  compiled_section_map
end

#process_escape_sequences=(val) ⇒ Object



30
31
32
# File 'lib/logstash/compiler/lscl.rb', line 30

def process_escape_sequences=(val)
  set_meta(PROCESS_ESCAPE_SEQUENCES, val)
end