Class: Fluent::CollectdNestOutput

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

Instance Method Summary collapse

Instance Method Details

#emit(tag, es, chain) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/fluent/plugin/out_collectd_nest.rb', line 9

def emit(tag, es, chain)
  tag = update_tag(tag)
  es.each { |time, record|
    Engine.emit(tag, time, normalize_record(record))
  }

  chain.next
end

#update_tag(tag) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fluent/plugin/out_collectd_nest.rb', line 19

def update_tag(tag)
  if remove_tag_prefix
    if remove_tag_prefix == tag
      tag = ''
    elsif tag.to_s.start_with?(remove_tag_prefix+'.')
      tag = tag[remove_tag_prefix.length+1 .. -1]
    end
  end
  if add_tag_prefix
    tag = tag && tag.length > 0 ? "#{add_tag_prefix}.#{tag}" : add_tag_prefix
  end
  return tag
end