class LogStash::Outputs::Swift::TimeRotationPolicy
Attributes
time_file[R]
Public Class Methods
new(time_file)
click to toggle source
# File lib/logstash/outputs/swift/time_rotation_policy.rb, line 8 def initialize(time_file) if time_file <= 0 raise LogStash::ConfigurationError, "`time_file` need to be greather than 0" end @time_file = time_file * 60 end
Public Instance Methods
needs_periodic?()
click to toggle source
# File lib/logstash/outputs/swift/time_rotation_policy.rb, line 20 def needs_periodic? true end
rotate?(file)
click to toggle source
# File lib/logstash/outputs/swift/time_rotation_policy.rb, line 16 def rotate?(file) file.size > 0 && (Time.now - file.ctime) >= time_file end