Class: Fluent::DataRejecterOutput

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

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



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

def configure(conf)
    super
    @remove = @remove_prefix.end_with?('.') ? @remove_prefix : @remove_prefix + '.'
    @add    = @add_prefix.end_with?('.')    ? @add_prefix    : @add_prefix    + '.'
    @add_p  = @add.chop
end

#emit(tag, es, chain) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/fluent/plugin/out_data_rejecter.rb', line 16

def emit(tag, es, chain)
    tmptag = (tag[@remove.size .. -1] if tag.start_with?(@remove)) || (tag == @remove_prefix ? '' : tag)
    tag    = @add_p.size.zero? ? (tmptag.size.zero? ? "data_rejecter.tag_lost" : tmptag) : (tmptag.size.zero? ? @add_p : @add + tmptag)

    es.each {| time, record |
        Engine.emit(tag, time, reject_record(record))
    }
    chain.next
end