Sha256: e9f7cd3232d4f9bdb753f71f6be3f34cecc4b36872cdbfe53f46173c6a60251c

Contents?: true

Size: 530 Bytes

Versions: 40

Compression:

Stored size: 530 Bytes

Contents

# encoding: utf-8
module LogStash
  module Outputs
    class S3
      class TimeRotationPolicy
        attr_reader :time_file

        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

        def rotate?(file)
          file.size > 0 && (Time.now - file.ctime) >= time_file
        end

        def needs_periodic?
          true
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
logstash-output-s3-4.1.6 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.5 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.4 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.3 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.2 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.1 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.0 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.13 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.12 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.11 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.10 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.9 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.8 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.7 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.6 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.5 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.3 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.2 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.1 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.0.0 lib/logstash/outputs/s3/time_rotation_policy.rb