Class: LogStash::Config::AST::Config
- Defined in:
- lib/logstash/config/config_ast.rb
Constant Summary
Constants included from LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers
LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::AND_METHOD, LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::BOOLEAN_DSL_METHOD_SIGNATURE, LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::NAND_METHOD, LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::OR_METHOD, LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers::XOR_METHOD
Instance Method Summary collapse
Methods inherited from Node
Methods included from LogStashCompilerLSCLGrammar::LogStash::Compiler::LSCL::AST::Helpers
#base_id, #base_protocol, #base_source_with_metadata, #base_source_with_metadata=, #compose, #compose_for, #jdsl, jdsl, #line_and_column, #source_meta
Instance Method Details
#compile ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/logstash/config/config_ast.rb', line 48 def compile LogStash::Config::AST.deferred_conditionals = [] LogStash::Config::AST.deferred_conditionals_index = 0 LogStash::Config::AST.plugin_instance_index = 0 code = [] code << <<-CODE @inputs = [] @filters = [] @outputs = [] @periodic_flushers = [] @shutdown_flushers = [] @generated_objects = {} CODE sections = recursive_select(LogStash::Config::AST::PluginSection) sections.each do |s| code << s.compile_initializer end # start inputs definitions = [] ["filter", "output"].each do |type| # defines @filter_func and @output_func # This need to be defined as a singleton method # so each instance of the pipeline has his own implementation # of the output/filter function definitions << "define_singleton_method :#{type}_func do |event|" definitions << " targeted_outputs = []" if type == "output" definitions << " events = event" if type == "filter" definitions << " @logger.debug? && @logger.debug(\"#{type} received\", \"event\" => event.to_hash)" if type == "output" definitions << " @logger.debug? && events.each { |e| @logger.debug(\"#{type} received\", \"event\" => e.to_hash)}" if type == "filter" sections.select { |s| s.plugin_type.text_value == type }.each do |s| definitions << s.compile.split("\n", -1).map { |e| " #{e}" } end definitions << " events" if type == "filter" definitions << " targeted_outputs" if type == "output" definitions << "end" end code += definitions.join("\n").split("\n", -1).collect { |l| " #{l}" } code += LogStash::Config::AST.deferred_conditionals return code.join("\n") end |
#process_escape_sequences=(val) ⇒ Object
43 44 45 |
# File 'lib/logstash/config/config_ast.rb', line 43 def process_escape_sequences=(val) (PROCESS_ESCAPE_SEQUENCES, val) end |