class Fluent::Plugin::UnixClientInput

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_unix_client.rb, line 33
def configure(conf)
  super
  @parser = parser_create
  @socket_handler = SocketHandler.new(@path, delimiter: @delimiter, log: log)
end
keep_receiving() click to toggle source
# File lib/fluent/plugin/in_unix_client.rb, line 44
def keep_receiving
  while thread_current_running?
    begin
      receive_and_emit
    rescue => e
      log.error "in_unix_client: error occurred. #{e}"
      sleep 3
    end
  end
ensure
  @socket_handler.try_close
end
receive_and_emit() click to toggle source
# File lib/fluent/plugin/in_unix_client.rb, line 57
def receive_and_emit
  raw_records = @socket_handler.try_receive
  return if raw_records.nil? || raw_records.empty?

  raw_records.each do |raw_record|
    @parser.parse(raw_record) do |time, record|
      router.emit(@tag, time, record)
    end
  end
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_unix_client.rb, line 39
def start
  super
  thread_create(:in_unix_client, &method(:keep_receiving))
end