mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- don't start up a File::Tail::Since until the file exists
- if File::Tail::Since does exit, we want to know about it
This commit is contained in:
parent
fff7413057
commit
2a4e947c34
1 changed files with 5 additions and 0 deletions
|
@ -18,10 +18,15 @@ module LogStash; module Net; module Clients
|
|||
def start_log_watcher
|
||||
@config.sources.each do |file, logtype|
|
||||
Thread.new do
|
||||
while not File.exists?(file) do
|
||||
@logger.debug "#{file} does not exist, sleeping 60 seconds"
|
||||
sleep(60)
|
||||
end
|
||||
@logger.info "Watching #{file} (type #{logtype})"
|
||||
File::Tail::Since.new(file).tail do |line|
|
||||
index(logtype, line.chomp)
|
||||
end
|
||||
raise "File::Tail::Since croaked for #{file}!"
|
||||
end
|
||||
end
|
||||
end # def start_log_watcher
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue