Class: LogStash::Inputs::File::Reader

Inherits:
EventMachine::FileTail
  • Object
show all
Defined in:
lib/logstash/inputs/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, receiver) ⇒ Reader

Returns a new instance of Reader.



40
41
42
43
44
# File 'lib/logstash/inputs/file.rb', line 40

def initialize(path, receiver)
  super(path)
  @receiver = receiver
  @buffer = BufferedTokenizer.new  # From eventmachine
end

Instance Method Details

#receive_data(data) ⇒ Object



46
47
48
49
50
51
# File 'lib/logstash/inputs/file.rb', line 46

def receive_data(data)
  # TODO(2.0): Support multiline log data
  @buffer.extract(data).each do |line|
    @receiver.receive(self, line)
  end
end