Parent

Class/Module Index [+]

Quicksearch

Fluent::ExecInput

Public Class Methods

new() click to toggle source
# File lib/fluent/plugin/in_exec.rb, line 24
def initialize
  super
end

Public Instance Methods

configure(conf) click to toggle source
# File lib/fluent/plugin/in_exec.rb, line 36
def configure(conf)
  super

  if localtime = conf['localtime']
    @localtime = true
  elsif utc = conf['utc']
    @localtime = false
  end

  if !@tag && !@tag_key
    raise ConfigError, "'tag' or 'tag_key' option is required on exec input"
  end

  @keys = @keys.split(',')

  if @time_key
    if @time_format
      f = @time_format
      @time_parse_proc = Proc.new {|str| Time.strptime(str, f).to_i }
    else
      @time_parse_proc = Proc.new {|str| str.to_i }
    end
  end
end
run() click to toggle source
# File lib/fluent/plugin/in_exec.rb, line 86
def run
  @io.each_line(&method(:each_line))
end
run_periodic() click to toggle source
# File lib/fluent/plugin/in_exec.rb, line 90
def run_periodic
  until @finished
    sleep @run_interval
    io = IO.popen(@command, "r")
    io.each_line(&method(:each_line))
    Process.waitpid(io.pid)
  end
end
shutdown() click to toggle source
# File lib/fluent/plugin/in_exec.rb, line 72
def shutdown
  if @run_interval
    @finished = true
    @thread.join
  else
    Process.kill(:TERM, @pid)
    if @thread.join(60)  # TODO wait time
      return
    end
    Process.kill(:KILL, @pid)
    @thread.join
  end
end
start() click to toggle source
# File lib/fluent/plugin/in_exec.rb, line 61
def start
  if @run_interval
    @finished = false
    @thread = Thread.new(&method(:run_periodic))
  else
    @io = IO.popen(@command, "r")
    @pid = @io.pid
    @thread = Thread.new(&method(:run))
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.