Class: Fluent::RecordModifierOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::RecordModifierOutput
- Includes:
- Mixin::ConfigPlaceholders, SetTagKeyMixin
- Defined in:
- lib/fluent/plugin/out_record_modifier.rb
Constant Summary collapse
- BUILTIN_CONFIGURATIONS =
%W(type tag include_tag_key tag_key char_encoding remove_keys)
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fluent/plugin/out_record_modifier.rb', line 16 def configure(conf) super @map = {} conf.each_pair { |k, v| unless BUILTIN_CONFIGURATIONS.include?(k) conf.has_key?(k) @map[k] = v end } if @char_encoding from, to = @char_encoding.split(':', 2) @from_enc = Encoding.find(from) @to_enc = Encoding.find(to) if to m = if @to_enc method(:convert_encoding) else method(:set_encoding) end (class << self; self; end).module_eval do define_method(:change_encoding, m) end end if @remove_keys @remove_keys = @remove_keys.split(',').map {|e| e.strip } end end |
#emit(tag, es, chain) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/fluent/plugin/out_record_modifier.rb', line 48 def emit(tag, es, chain) es.each { |time, record| filter_record(tag, time, record) Engine.emit(@tag, time, modify_record(record)) } chain.next end |