Class: Fluent::NamedPipeOutput

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

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



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

def configure(conf)
  super

  begin
    @pipe = PluginNamedPipe::Fifo.new(@path, :w)
  rescue => e
    raise ConfigError, "#{e.class}: #{e.message}"
  end

  @formatter = Plugin.new_formatter(@format)
  @formatter.configure(conf)
end

#emit(tag, es, chain) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fluent/plugin/out_named_pipe.rb', line 31

def emit(tag, es, chain)
  es.each do |time, record|
    @pipe.write @formatter.format(tag, time, record)
    @pipe.flush
  end

  chain.next
rescue => e
  log.error "out_named_pipe: unexpected error", :error_class => e.class, :error => e.to_s
  log.error_backtrace
end

#shutdownObject



27
28
29
# File 'lib/fluent/plugin/out_named_pipe.rb', line 27

def shutdown
  @pipe.close
end