Class: Fluent::HatoOutput

Inherits:
Output
  • Object
show all
Includes:
HandleTagNameMixin
Defined in:
lib/fluent/plugin/out_hato.rb

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
# File 'lib/fluent/plugin/out_hato.rb', line 16

def configure(conf)
  super

  if @api_key.nil?
    raise Fluent::ConfigError(
      '[out_hato] missing mandatory parameter: `api_key`'
    )
  end

  if @host.nil?
    raise Fluent::ConfigError(
      '[out_hato] missing mandatory parameter: `host`'
    )
  end

  @api_endpoint = '%s://%s:%s/notify' % [
    @scheme,
    @host,
    @port,
  ]
end

#emit(tag, es, chain) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/fluent/plugin/out_hato.rb', line 38

def emit(tag, es, chain)
  es.each do |time, record|
    message = message_format % message_keys.split(/\s*,\s*/).map do |key|
      record[key].to_s
    end
    send_message(tag, message)
  end
end