Class: Fluent::Plugin::TailInput::TailWatcher::RotateHandler
- Inherits:
-
Object
- Object
- Fluent::Plugin::TailInput::TailWatcher::RotateHandler
- Defined in:
- lib/fluent/plugin/in_tail.rb
Instance Method Summary collapse
-
#initialize(log, &on_rotate) ⇒ RotateHandler
constructor
A new instance of RotateHandler.
- #on_notify(stat) ⇒ Object
Constructor Details
#initialize(log, &on_rotate) ⇒ RotateHandler
Returns a new instance of RotateHandler.
995 996 997 998 999 1000 |
# File 'lib/fluent/plugin/in_tail.rb', line 995 def initialize(log, &on_rotate) @log = log @inode = nil @fsize = -1 # first @on_rotate = on_rotate end |
Instance Method Details
#on_notify(stat) ⇒ Object
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 |
# File 'lib/fluent/plugin/in_tail.rb', line 1002 def on_notify(stat) if stat.nil? inode = nil fsize = 0 else inode = stat.ino fsize = stat.size end if @inode != inode || fsize < @fsize @on_rotate.call(stat) end @inode = inode @fsize = fsize rescue @log.error $!.to_s @log.error_backtrace end |