Class: Fluent::OrderOutput

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

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fluent/plugin/out_order.rb', line 8

def configure(conf)
    super

    @add_tag_prefix = conf['add_tag_prefix']
    if @add_tag_prefix.nil?
        raise Fluent::ConfigError, "add_tag_prefix is required!"
    end

    @after_order_keys = conf["after_order_keys"]
    if @after_order_keys.nil?
        raise Fluent::ConfigError, "after_order_keys is required!"
    end

    @after_order_keys = @after_order_keys.split(',');
    unless @after_order_keys.count > 0
        raise Fluent::ConfigError, "after_order_keys is invalied! after_order_keys=#{@after_order_keys}"
    end
end

#emit(tag, es, chain) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/fluent/plugin/out_order.rb', line 27

def emit(tag, es, chain)
    es.each { |time, record|
        chain.next

        new_record = _order_record(record);

        Fluent::Engine.emit("#{@add_tag_prefix}.#{tag}", time, new_record)
    }
end