# File lib/fluent/plugin/in_tail.rb, line 660 def initialize(path, log, &on_rotate) @path = path @inode = nil @fsize = -1 # first @on_rotate = on_rotate @log = log end
# File lib/fluent/plugin/in_tail.rb, line 668 def on_notify begin stat = File.stat(@path) inode = stat.ino fsize = stat.size rescue Errno::ENOENT # moved or deleted inode = nil fsize = 0 end begin if @inode != inode || fsize < @fsize # rotated or truncated begin io = File.open(@path) rescue Errno::ENOENT end @on_rotate.call(io) end @inode = inode @fsize = fsize end rescue @log.error $!.to_s @log.error_backtrace end