mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
- 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:
parent
f85e708d0f
commit
d8e5bfaca5
1 changed files with 6 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue