Sha256: bded5acc8716272a157bae76ff4a758217d636315ca6d7492bf07e1e66291364

Contents?: true

Size: 897 Bytes

Versions: 112

Compression:

Stored size: 897 Bytes

Contents

# encoding: utf-8
require "logstash/namespace"
require "logstash/config/grammar"
require "logstash/config/config_ast"
require "logstash/config/registry"
require "logstash/errors"
require "logger"

class LogStash::Config::File
  include Enumerable
  attr_accessor :logger

  public
  def initialize(text)
    @logger = Cabin::Channel.get(LogStash)
    @text = text
    @config = parse(text)
  end # def initialize

  def parse(text)
    grammar = LogStashConfigParser.new
    result = grammar.parse(text)
    if result.nil?
      raise LogStash::ConfigurationError, grammar.failure_reason
    end
    return result
  end # def parse

  def plugin(plugin_type, name, *args)
    klass = LogStash::Plugin.lookup(plugin_type, name)
    return klass.new(*args)
  end

  def each
    @config.recursive_select(LogStash::Config::AST::Plugin)
  end
end #  class LogStash::Config::Parser

#agent.config(cfg)

Version data entries

112 entries across 109 versions & 6 rubygems

Version Path
logstash-core-5.0.0.alpha1-java lib/logstash/config/file.rb
logstash-core-5.0.0.alpha1.snapshot2-java lib/logstash/config/file.rb
logstash-core-5.0.0.alpha1.snapshot1-java lib/logstash/config/file.rb
logstash-core-2.2.3-java lib/logstash/config/file.rb
logstash-core-2.3.0-java lib/logstash/config/file.rb
logstash-core-2.3.0.snapshot5-java lib/logstash/config/file.rb
logstash-core-2.2.3.snapshot2-java lib/logstash/config/file.rb
logstash-core-2.3.0.snapshot4-java lib/logstash/config/file.rb
logstash-core-2.3.0.snapshot3-java lib/logstash/config/file.rb
logstash-core-2.3.0.snapshot1-java lib/logstash/config/file.rb
logstash-core-2.2.2-java lib/logstash/config/file.rb
logstash-core-2.1.3-java lib/logstash/config/file.rb
logstash-core-2.2.1-java lib/logstash/config/file.rb
logstash-core-2.2.1.snapshot1-java lib/logstash/config/file.rb
logstash-core-2.1.2-java lib/logstash/config/file.rb
logstash-core-2.2.0-java lib/logstash/config/file.rb
logstash-core-2.1.2.snapshot1-java lib/logstash/config/file.rb
logstash-core-2.2.0.snapshot3-java lib/logstash/config/file.rb
logstash-core-2.2.0.snapshot2-java lib/logstash/config/file.rb
logstash-core-2.1.1-java lib/logstash/config/file.rb