class LogStash::Outputs::LogstashAzureBlobOutput::TimeRotationPolicy
a sub class of LogstashAzureBlobOutput
sets the policy for time rotation
Attributes
time_file[R]
Public Class Methods
new(time_file)
click to toggle source
initialize the class and validate the time file
# File lib/logstash/outputs/blob/time_rotation_policy.rb, line 9 def initialize(time_file) if time_file <= 0 raise LogStash::ConfigurationError.new('`time_file` need to be greather than 0') end @time_file = time_file * 60 end
Public Instance Methods
needs_periodic?()
click to toggle source
boolean method
# File lib/logstash/outputs/blob/time_rotation_policy.rb, line 23 def needs_periodic? true end
rotate?(file)
click to toggle source
rotates based on time policy
# File lib/logstash/outputs/blob/time_rotation_policy.rb, line 18 def rotate?(file) !file.empty? && (Time.now - file.ctime) >= time_file end