Class: Fluent::Simple2hash

Inherits:
Filter
  • Object
show all
Defined in:
lib/fluent/plugin/filter_simple2hash.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



7
8
9
10
# File 'lib/fluent/plugin/filter_simple2hash.rb', line 7

def configure(conf)
  super
  @var ||= conf['var']
end

#filter(tag, time, record) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/fluent/plugin/filter_simple2hash.rb', line 12

def filter(tag, time, record)
  if record.is_a?(Numeric) or record.is_a?(Array) or record.is_a?(String)
    obj = Hash.new
    obj[@var] = record
    return obj
  else
    return record
  end
end