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-zst-1.1.0 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-zst-1.0.0 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-integration-aws-7.0.1 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.4.1 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-integration-aws-7.0.0 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.4.0 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.3.7 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.3.6 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-integration-aws-0.1.0.pre lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.3.5 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.3.4 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.3.3 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.3.2 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.3.1 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.3.0 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.2.0 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.10 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.9 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.8 lib/logstash/outputs/s3/time_rotation_policy.rb
logstash-output-s3-4.1.7 lib/logstash/outputs/s3/time_rotation_policy.rb