Class: Fluent::LogioOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::LogioOutput
- Defined in:
- lib/fluent/plugin/out_logio.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/fluent/plugin/out_logio.rb', line 19 def configure(conf) super @formatter = Plugin.new_formatter(@output_type) @formatter.configure(conf) end |
#emit(tag, es, chain) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fluent/plugin/out_logio.rb', line 39 def emit(tag, es, chain) es.each do |time,record| stream = @stream ? @stream : tag node = @node ? @node : Socket.gethostname logLevel = @log_level stream = (record[@stream_key_name] or stream) if @stream_key_name node = (record[@node_key_name] or node) if @node_key_name logLevel = (record[@log_level_key_name] or logLevel) if @log_level_key_name @socket.puts "+log|#{stream}|#{node}|#{logLevel}|#{@formatter.format(tag, time, record).chomp}\r\n" end chain.next rescue => e log.error "emit", :error_class => e.class, :error => e.to_s log.error_backtrace end |
#shutdown ⇒ Object
33 34 35 36 37 |
# File 'lib/fluent/plugin/out_logio.rb', line 33 def shutdown super @socket.close end |
#start ⇒ Object
26 27 28 29 30 31 |
# File 'lib/fluent/plugin/out_logio.rb', line 26 def start super puts @host puts @port @socket = TCPSocket.open(@host, @port) end |