class Fluent::Plugin::TagRewriteOutput

Public Instance Methods

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

  if @tag_prefix.nil? && @tag_prefix.nil?
    raise Fluent::ConfigError, "Neither tag_prefix nor tag_suffix has not been provided"
  end
end
multi_workers_ready?() click to toggle source
# File lib/fluent/plugin/out_tag_rewrite.rb, line 19
def multi_workers_ready?
  true
end
process(tag, es) click to toggle source
# File lib/fluent/plugin/out_tag_rewrite.rb, line 23
def process(tag, es)
  es.each do |time, record|
    begin
      rewritten_tag = tag
      unless @tag_prefix.nil?
        rewritten_tag = @tag_prefix + "." + rewritten_tag
      end
      unless @tag_suffix.nil?
        rewritten_tag = rewritten_tag + "." + @tag_suffix
      end
      router.emit(rewritten_tag, time, record)
    rescue
      $log.error("unexpected error in tag_rewrite", :error => $!.to_s)
      $log.error_backtrace
    end
  end
end