- In case we are using globs, replace the path in the file url with whatever

EM::FileTail says it is.
This commit is contained in:
Jordan Sissel 2010-11-12 04:06:56 +00:00
parent f85e708d0f
commit d8e5bfaca5

View file

@ -16,9 +16,12 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
exclude=[], receiver=self) exclude=[], receiver=self)
end end
def receive(event) def receive(filetail, event)
url = @url.clone
url.path = filetail.path
@logger.debug(["original url", { :originalurl => @url, :newurl => url }])
event = LogStash::Event.new({ event = LogStash::Event.new({
"@source" => @url.to_s, "@source" => url.to_s,
"@message" => event, "@message" => event,
"@type" => @type, "@type" => @type,
"@tags" => @tags.clone, "@tags" => @tags.clone,
@ -37,7 +40,7 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
def receive_data(data) def receive_data(data)
# TODO(2.0): Support multiline log data # TODO(2.0): Support multiline log data
@buffer.extract(data).each do |line| @buffer.extract(data).each do |line|
@receiver.receive(line) @receiver.receive(self, line)
end end
end # def receive_data end # def receive_data
end # class Reader end # class Reader