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-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/logstash-core-2.4.1-java/lib/logstash/config/file.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/logstash-core-2.4.1-java/lib/logstash/config/file.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/logstash-core-2.4.1-java/lib/logstash/config/file.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/logstash-core-2.4.1-java/lib/logstash/config/file.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/logstash-core-2.4.1-java/lib/logstash/config/file.rb
logstash-core-2.4.1-java lib/logstash/config/file.rb
logstash-core-2.4.0-java lib/logstash/config/file.rb
logstash-core-2.4.0.snapshot4-java lib/logstash/config/file.rb
logstash-core-2.4.0.snapshot3-java lib/logstash/config/file.rb
logstash-core-5.0.0.alpha6.snapshot1-java lib/logstash/config/file.rb
logstash-core-2.4.0.snapshot2-java lib/logstash/config/file.rb
logstash-core-2.4.0.snapshot1-java lib/logstash/config/file.rb
logstash-core-5.0.0.alpha5.snapshot1-java lib/logstash/config/file.rb
logstash-core-2.3.4-java lib/logstash/config/file.rb
logstash-core-2.3.4.snapshot1-java lib/logstash/config/file.rb
logstash-core-5.0.0.alpha4.snapshot3-java lib/logstash/config/file.rb
logstash-core-5.0.0.alpha4.snapshot2-java lib/logstash/config/file.rb
logstash-core-2.3.3-java lib/logstash/config/file.rb
logstash-core-2.3.3.snapshot2-java lib/logstash/config/file.rb
logstash-core-5.0.0.alpha4.snapshot1-java lib/logstash/config/file.rb