logstash-input-file 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 581d2e0d0226001ca38ff0bc76e043886605b1f2
4
- data.tar.gz: a2f6a6e76baa734b7b8632f9175f4202ed77d8c5
3
+ metadata.gz: adb0ee83a05f531fd594701ca39754fc78f7ec3a
4
+ data.tar.gz: 2cfe3f3ea0f532cde7d762821540d17180d0c927
5
5
  SHA512:
6
- metadata.gz: f42dcbc3e885b978c01be71259dd65ac87b7b5ec78eba41cc1f642a6902569a598c8d122fecf7c219ab96057f7adf08a4317fb2c8c8dd21e1cb36332068abbe3
7
- data.tar.gz: 14ff48936b13aee32f0e8ed73c20355603833fc5d7705f5b6601067a559766a591063479b0e13d0f01712d32c55d4106823316bd94d5e780087cacec000b7ed4
6
+ metadata.gz: d5c2ae3efb6a29d350c804bd419ba9dbbacae6370c8f0df38e14bdd7f88f95b2c9591865c18b636cab3f1545036b96f598f3e7034f2defae6f9c5e02b24f64d3
7
+ data.tar.gz: 198d997d546af886286a2cdfd7e27fbefc785268b696113ab3eb008d655395985322ca0a6f0c876ccaa8b38857ccfde97e70d5613af2a76d1d50e9dc176ced1b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 2.2.2
2
+ - Fix for: Filewatch library complains if HOME or SINCEDB_PATH variables are unset.
3
+ - [Issue #101](https://github.com/logstash-plugins/logstash-input-file/issues/101)
4
+ - [PR, filewatch 78](https://github.com/jordansissel/ruby-filewatch/pull/78) introduces the fix
5
+ - [Issue, filewatch 76](https://github.com/jordansissel/ruby-filewatch/issues/76)
6
+ - Improve documentation on ignore_older and close_older options [#104](https://github.com/logstash-plugins/logstash-input-file/issues/104) Documentation
7
+
1
8
  ## 2.2.1
2
9
  - Fix spec failures on CI Linux builds (not seen on local OSX and Linux)
3
10
 
@@ -77,7 +77,7 @@ class LogStash::Codecs::Base
77
77
  end
78
78
  end
79
79
  if !method_defined?(:auto_flush)
80
- def auto_flush
80
+ def auto_flush(*)
81
81
  end
82
82
  end
83
83
  end
@@ -139,14 +139,14 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
139
139
  # set the new line delimiter, defaults to "\n"
140
140
  config :delimiter, :validate => :string, :default => "\n"
141
141
 
142
- # If this option is specified, when the file input discovers a file that
143
- # was last modified before the specified timespan in seconds, the file is
144
- # ignored. After it's discovery, if an ignored file is modified it is no
142
+ # When the file input discovers a file that was last modified
143
+ # before the specified timespan in seconds, the file is ignored.
144
+ # After it's discovery, if an ignored file is modified it is no
145
145
  # longer ignored and any new data is read. The default is 24 hours.
146
146
  config :ignore_older, :validate => :number, :default => 24 * 60 * 60
147
147
 
148
- # If this option is specified, the file input closes any files that were last
149
- # read the specified timespan in seconds ago.
148
+ # The file input closes any files that were last read the specified
149
+ # timespan in seconds ago.
150
150
  # This has different implications depending on if a file is being tailed or
151
151
  # read. If tailing, and there is a large time gap in incoming data the file
152
152
  # can be closed (allowing other files to be opened) but will be queued for
@@ -269,6 +269,10 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
269
269
  end
270
270
  end
271
271
 
272
+ class FlushableListener < ListenerTail
273
+ attr_writer :path
274
+ end
275
+
272
276
  def listener_for(path)
273
277
  # path is the identity
274
278
  ListenerTail.new(path, self)
@@ -288,6 +292,7 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
288
292
  begin_tailing
289
293
  @queue = queue
290
294
  @tail.subscribe(self)
295
+ exit_flush
291
296
  end # def run
292
297
 
293
298
  def post_process_this(event)
@@ -310,4 +315,22 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
310
315
  @tail.quit
311
316
  end
312
317
  end
318
+
319
+ private
320
+
321
+ def exit_flush
322
+ listener = FlushableListener.new("none", self)
323
+ if @codec.identity_count.zero?
324
+ # using the base codec without identity/path info
325
+ @codec.base_codec.flush do |event|
326
+ begin
327
+ listener.process_event(event)
328
+ rescue => e
329
+ @logger.error("File Input: flush on exit downstream error", :exception => e)
330
+ end
331
+ end
332
+ else
333
+ @codec.flush_mapped(listener)
334
+ end
335
+ end
313
336
  end # class LogStash::Inputs::File
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-file'
4
- s.version = '2.2.1'
4
+ s.version = '2.2.2'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Stream 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/plugin install gemname. This gem is not a stand-alone program"
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.add_runtime_dependency 'logstash-codec-plain'
26
26
  s.add_runtime_dependency 'addressable'
27
- s.add_runtime_dependency 'filewatch', ['>= 0.8.0', '~> 0.8']
27
+ s.add_runtime_dependency 'filewatch', ['>= 0.8.1', '~> 0.8']
28
28
  s.add_runtime_dependency 'logstash-codec-multiline', ['~> 2.0.7']
29
29
 
30
30
  s.add_development_dependency 'stud', ['~> 0.0.19']
@@ -181,15 +181,11 @@ describe LogStash::Inputs::File do
181
181
  expect(events.size).to eq(0)
182
182
  File.open(tmpfile_path, "a") { |fd| fd.puts("hello"); fd.puts("world") }
183
183
  end
184
- .then_after(0.1, "only one event is created, the last line is buffered") do
185
- expect(events.size).to eq(1)
186
- end
187
- .then_after(0.1, "quit") do
184
+ .then_after(0.25, "quit") do
188
185
  subject.stop
189
186
  end
187
+
190
188
  subject.run(events)
191
- # stop flushes the second event
192
- expect(events.size).to eq(2)
193
189
 
194
190
  event1 = events[0]
195
191
  expect(event1).not_to be_nil
data/spec/spec_helper.rb CHANGED
@@ -47,9 +47,12 @@ module FileInput
47
47
  def accept(listener)
48
48
  @tracer.push [:accept, true]
49
49
  end
50
- def auto_flush()
50
+ def auto_flush(*)
51
51
  @tracer.push [:auto_flush, true]
52
52
  end
53
+ def flush(*)
54
+ @tracer.push [:flush, true]
55
+ end
53
56
  def close
54
57
  @tracer.push [:close, true]
55
58
  end
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: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-04 00:00:00.000000000 Z
11
+ date: 2016-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core
@@ -64,7 +64,7 @@ dependencies:
64
64
  requirements:
65
65
  - - '>='
66
66
  - !ruby/object:Gem::Version
67
- version: 0.8.0
67
+ version: 0.8.1
68
68
  - - ~>
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0.8'
@@ -72,7 +72,7 @@ dependencies:
72
72
  requirements:
73
73
  - - '>='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.8.0
75
+ version: 0.8.1
76
76
  - - ~>
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0.8'