Sha256: 3857b1511019647400ad0543feb0b79f3c03d978a432e139d7514e97e1d3f7b0

Contents?: true

Size: 865 Bytes

Versions: 14

Compression:

Stored size: 865 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("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

14 entries across 14 versions & 1 rubygems

Version Path
logstash-input-file-4.2.2 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.2.1 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.2.0 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.18 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.17 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.16 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.15 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.14 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.13 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.12 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.11 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.10 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.9 lib/filewatch/tail_mode/handlers/shrink.rb
logstash-input-file-4.1.8 lib/filewatch/tail_mode/handlers/shrink.rb