logstash-input-file 4.1.7 → 4.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 452117d6e30aa2df0ee9aa1f7c663a4bed00569489a53ba479f8b68789bb9051
4
- data.tar.gz: 1724d57ff775ed4df8ef3821cafdb044163a8b6c246269269db4e7ef7d1bbe00
3
+ metadata.gz: b86fa03636ec6ef833c6fced1c2d42abfc5067f34a70bce8d3362a98c91ff566
4
+ data.tar.gz: 691ab87c3fd89b33d36ffa151be97cd91147aca22d23c1a20a171adc3d104f05
5
5
  SHA512:
6
- metadata.gz: 555004eb3d45f7042703e1adc61b027a009baef5578ee6d3e4d22318c0a26244c47da571b68f55041851e82b305dbfcb7fd08d4888e4f85ca95cce63627b3d51
7
- data.tar.gz: 7a4988cf0671f09eb1e37ed007adbee6aeb3f097f449e6246f04ac9e40dde80139343b0ae1f5321fd94f540b15b05e2dee676d208b0c71b944e8a9512ae985e2
6
+ metadata.gz: fe9f47707469145ca8b5343bcaeeeec17aaf193aad821e23db1400454e1f686e27007365e1c44a2d0f58d1d4cb49cb52cb51af90e5077c6c62cce4dac7c1fa3b
7
+ data.tar.gz: 2b531984da98f653dfa25af2b571b401318980f4b6d93043a0d3c1f7a147a39f4174305cb50ce3634875330bcac871c2b4c08d4bdac1c3256a0c7521a15c4233
@@ -1,3 +1,8 @@
1
+ ## 4.1.8
2
+ - Fixed problem in tail and read modes where the read loop could get stuck if an IO error occurs in the loop.
3
+ The file appears to be being read but it is not, suspected with file truncation schemes.
4
+ [Issue #205](https://github.com/logstash-plugins/logstash-input-file/issues/205)
5
+
1
6
  ## 4.1.7
2
7
  - Fixed problem in rotation handling where the target file being rotated was
3
8
  subjected to the start_position setting when it must always start from the beginning.
@@ -42,7 +42,23 @@ module FileWatch
42
42
  end
43
43
 
44
44
  BufferExtractResult = Struct.new(:lines, :warning, :additional)
45
- LoopControlResult = Struct.new(:count, :size, :more)
45
+
46
+ class LoopControlResult
47
+ attr_reader :count, :size, :more
48
+
49
+ def initialize(count, size, more)
50
+ @count, @size, @more = count, size, more
51
+ @read_error_detected = false
52
+ end
53
+
54
+ def flag_read_error
55
+ @read_error_detected = true
56
+ end
57
+
58
+ def keep_looping?
59
+ !@read_error_detected && @more
60
+ end
61
+ end
46
62
 
47
63
  class NoSinceDBPathGiven < StandardError; end
48
64
 
@@ -10,7 +10,7 @@ module FileWatch module ReadMode module Handlers
10
10
  loop_control = watched_file.loop_control_adjusted_for_stat_size
11
11
  controlled_read(watched_file, loop_control)
12
12
  sincedb_collection.request_disk_flush
13
- break unless loop_control.more
13
+ break unless loop_control.keep_looping?
14
14
  end
15
15
  if watched_file.all_read?
16
16
  # flush the buffer now in case there is no final delimiter
@@ -42,14 +42,17 @@ module FileWatch module ReadMode module Handlers
42
42
  end
43
43
  rescue EOFError
44
44
  logger.error("controlled_read: eof error reading file", "path" => watched_file.path, "error" => e.inspect, "backtrace" => e.backtrace.take(8))
45
+ loop_control.flag_read_error
45
46
  break
46
47
  rescue Errno::EWOULDBLOCK, Errno::EINTR
47
48
  logger.error("controlled_read: block or interrupt error reading file", "path" => watched_file.path, "error" => e.inspect, "backtrace" => e.backtrace.take(8))
48
49
  watched_file.listener.error
50
+ loop_control.flag_read_error
49
51
  break
50
52
  rescue => e
51
53
  logger.error("controlled_read: general error reading file", "path" => watched_file.path, "error" => e.inspect, "backtrace" => e.backtrace.take(8))
52
54
  watched_file.listener.error
55
+ loop_control.flag_read_error
53
56
  break
54
57
  end
55
58
  end
@@ -59,13 +59,16 @@ module FileWatch module TailMode module Handlers
59
59
  end
60
60
  rescue EOFError
61
61
  # it only makes sense to signal EOF in "read" mode not "tail"
62
+ loop_control.flag_read_error
62
63
  break
63
64
  rescue Errno::EWOULDBLOCK, Errno::EINTR
64
65
  watched_file.listener.error
66
+ loop_control.flag_read_error
65
67
  break
66
68
  rescue => e
67
69
  logger.error("read_to_eof: general error reading #{watched_file.path}", "error" => e.inspect, "backtrace" => e.backtrace.take(4))
68
70
  watched_file.listener.error
71
+ loop_control.flag_read_error
69
72
  break
70
73
  end
71
74
  end
@@ -8,7 +8,7 @@ module FileWatch module TailMode module Handlers
8
8
  break if quit?
9
9
  loop_control = watched_file.loop_control_adjusted_for_stat_size
10
10
  controlled_read(watched_file, loop_control)
11
- break unless loop_control.more
11
+ break unless loop_control.keep_looping?
12
12
  end
13
13
  end
14
14
  end
@@ -9,7 +9,7 @@ module FileWatch module TailMode module Handlers
9
9
  break if quit?
10
10
  loop_control = watched_file.loop_control_adjusted_for_stat_size
11
11
  controlled_read(watched_file, loop_control)
12
- break unless loop_control.more
12
+ break unless loop_control.keep_looping?
13
13
  end
14
14
  end
15
15
 
Binary file
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-file'
4
- s.version = '4.1.7'
4
+ s.version = '4.1.8'
5
5
  s.licenses = ['Apache-2.0']
6
6
  s.summary = "Streams events from files"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-file
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.7
4
+ version: 4.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2018-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement