class Fluent::Kaboom

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_kaboom.rb, line 18
def configure(conf)
  super

  @record_exploder = RecordExploder.new(ValuesRetriever.new)
  @tag_updater = TagUpdater.new
  @keys_validator = KeysValidator.new

  key_pattern = "^([^\\\"\\.]+\\.)*[^\\\"\.]+$"

  key_regex = Regexp.new(key_pattern)

  if (!@tag && !@add_tag_prefix && !@remove_tag_prefix)
    raise ConfigError, "One of tag, add_tag_prefix, or remove_tag_prefix must be set. remove_tag_prefix and add_tag_prefix may be used together."
  elsif (@tag && (@add_tag_prefix || @remove_tag_prefix))
    raise ConfigError, "tag can not be used in conjunction with add_tag_prefix or remove_tag_prefix; the former would override the latter."
  elsif (!@key.match(key_pattern))
    raise ConfigError, "key is malformed; it should consist of dot-separated field names like foo.bar.baz or \"f.oo\".bar.baz if part of your key contains dots."
  end
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_kaboom.rb, line 46
def emit(tag, es, chain)
  chain.next
  
  new_tag = tag
  if (@tag)
    new_tag = @tag
  else
    new_tag = @tag_updater.update_tag(tag, @remove_tag_prefix, @add_tag_prefix)
  end

  keys = key.split(".")

  es.each do |time,record|

    new_records = []

    if (@keys_validator.keys_are_valid?(keys, record) === false)
      new_records = [record]
    else
      new_records = @record_exploder.explode_record(keys, record)
    end
      
    new_records.each do |record|
      router.emit(new_tag, time, record)
    end
  end
end
shutdown() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_kaboom.rb, line 42
def shutdown
  super
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_kaboom.rb, line 38
def start
  super
end