Sha256: eec03b579c9c4216c5f4d2b01b9217e0034e92efd6abb878d64ebd79330c9b78

Contents?: true

Size: 874 Bytes

Versions: 11

Compression:

Stored size: 874 Bytes

Contents

# encoding: utf-8

module FileWatch module TailMode module Handlers
  class Shrink < Base
    def handle_specifically(watched_file)
      add_or_update_sincedb_collection(watched_file)
      watched_file.file_seek(watched_file.bytes_read)
      loop do
        break if quit?
        loop_control = watched_file.loop_control_adjusted_for_stat_size
        controlled_read(watched_file, loop_control)
        break unless loop_control.keep_looping?
      end
    end

    def update_existing_specifically(watched_file, sincedb_value)
      # we have a match but size is smaller - set all to zero
      watched_file.reset_bytes_unread
      sincedb_value.update_position(0)
      logger.trace? && logger.trace("update_existing_specifically: was truncated seeking to beginning", :watched_file => watched_file.details, :sincedb_value => sincedb_value)
    end
  end
end end end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
logstash-input-file-4.4.6 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.4.5 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.4.4 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.4.3 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.4.2 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.4.1 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.4.0 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.3.1 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.3.0 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.2.4 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.2.3 lib/filewatch/tail_mode/handlers/shrink.rb