class LogStash::Inputs::File
Public Class Methods
new(url, type, config={}, &block)
click to toggle source
Calls superclass method
LogStash::Inputs::Base::new
# File lib/logstash/inputs/file.rb, line 8 def initialize(url, type, config={}, &block) super # Hack the hostname into the url. # This works since file:// urls don't generally have a host in it. @url.host = Socket.gethostname end
Public Instance Methods
receive(filetail, event)
click to toggle source
# File lib/logstash/inputs/file.rb, line 24 def receive(filetail, event) url = @url.clone url.path = filetail.path @logger.debug(["original url", { :originalurl => @url, :newurl => url }]) event = LogStash::Event.new({ "@message" => event, "@type" => @type, "@tags" => @tags.clone, }) event.source = url @logger.debug(["Got event", event]) @callback.call(event) end
register()
click to toggle source
# File lib/logstash/inputs/file.rb, line 17 def register @logger.info("Registering #{@url}") EventMachine::FileGlobWatchTail.new(@url.path, Reader, interval=60, exclude=[], receiver=self) end