Sha256: df7e630118acc771ce84d1fe9283f517d38fe1b2b24f3bd486d497a671b57bdb
Contents?: true
Size: 786 Bytes
Versions: 4
Compression:
Stored size: 786 Bytes
Contents
# { # "convert": { # "field": "duration", # "type": "integer" # } # } module Anschel class Filter def convert conf, log field = conf.delete :field type = conf.delete :type raise 'Missing required "field" for "convert" filter' if field.nil? raise 'Missing required "type" for "convert" filter' if type.nil? field = field.to_sym type_conversions = { 'integer' => :to_i, 'float' => :to_f, 'string' => :to_s } log.trace event: 'filter-compiled', kind: 'convert', \ field: field, type: type lambda do |event| return event unless event.has_key? field event[field] = event[field].send type_conversions[type] filtered event, conf end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
anschel-0.6.5 | lib/anschel/filter/convert.rb |
anschel-0.6.4 | lib/anschel/filter/convert.rb |
anschel-0.6.3 | lib/anschel/filter/convert.rb |
anschel-0.6.2 | lib/anschel/filter/convert.rb |