class Fluent::RawExecOutput
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_rawexec.rb, line 22 def initialize super require 'tempfile' @localtime = false end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_rawexec.rb, line 31 def configure(conf) super end
format(tag, time, record)
click to toggle source
# File lib/fluent/plugin/out_rawexec.rb, line 35 def format(tag, time, record) if @tag record.merge!(@tag => tag) end out = '' out << Yajl::Encoder.encode(record) out << "\n" out end
write(chunk)
click to toggle source
# File lib/fluent/plugin/out_rawexec.rb, line 45 def write(chunk) if chunk.respond_to?(:path) prog = "#{@command} #{chunk.path}" else tmpfile = Tempfile.new("fluent-plugin-rawexec-") chunk.write_to(tmpfile) tmpfile.close prog = "#{@command} #{tmpfile.path}" end system(prog) ecode = $?.to_i tmpfile.delete if tmpfile if ecode != 0 raise "command returns #{ecode}: #{prog}" end end