Class: Fluent::Plugin::TagRewriteOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_tag_rewrite.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



11
12
13
14
15
16
17
# 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?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/fluent/plugin/out_tag_rewrite.rb', line 19

def multi_workers_ready?
  true
end

#process(tag, es) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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