class Fluent::Plugin::RenameKeyOutput

Constants

DEFAULT_APPEND_TAG

Public Instance Methods

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

  create_rename_rules(conf)
  create_replace_rules(conf)

  raise Fluent::ConfigError, 'No rename nor replace rules are given' if @rename_rules.empty? && @replace_rules.empty?

  @remove_tag_prefix = /^#{Regexp.escape @remove_tag_prefix}\.?/ if @remove_tag_prefix
end
multi_workers_ready?() click to toggle source
# File lib/fluent/plugin/out_rename_key.rb, line 31
def multi_workers_ready?
  true
end
process(tag, es) click to toggle source
# File lib/fluent/plugin/out_rename_key.rb, line 35
def process tag, es
  es.each do |time, record|
    new_tag = @remove_tag_prefix ? tag.sub(@remove_tag_prefix, '') : tag
    new_tag = "#{new_tag}.#{@append_tag}".sub(/^\./, '')
    new_record = rename_key record
    new_record = replace_key new_record
    router.emit new_tag, time, new_record
  end
end