logstash-input-file 4.4.5 → 4.4.6

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: 063f72c89ee45f05e386433cc55b797597ceed3fbda22f37dc1034275e8e9530
4
- data.tar.gz: fe76691a8f46897b716aa9dca6a9420896e619d85f1ca1e12181e1b6f0f5765a
3
+ metadata.gz: eabfa7af5953763874689d9cba6691d9184de195e33dbf40425021653e8f3548
4
+ data.tar.gz: cdca8f6300254f1d32b327194ed5977f85bb47b6912a27170d4bbacae2d6bad8
5
5
  SHA512:
6
- metadata.gz: 9416e24b57cc632d9182fee5d082f6ca58a31da78f97f013fb07af4b877d341508911a8eb418ef782493c0146f9f04a6477471ab5fa180f3398667426b37e098
7
- data.tar.gz: bdda74f5fd273e5fee2ab9b15bda33491cc6c8afded19b501df97afffcbb14623c698a109d466d430119d88c04be4649a51892fb5a8f9e09f0ad395ec64d64a4
6
+ metadata.gz: bbbe5f2f43e7ef106a67bc63ebacb71d1312574dbfac8f4566ab4fef400ad751d6be0e258d8eac2358116c6e90584ca0664b2a5d44e0d853d84ff2703f148904
7
+ data.tar.gz: 4a7f8f7bedc904dc059ffe8acac14da3ff63663b6a4a5e748c8750952e85a5f15dc0024d696c3de5611fd40408e8f7be7d30c8cb0c5ca9ac2f436aab55d8bb4d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.4.6
2
+ - Change read mode to immediately stop consuming buffered lines when shutdown is requested [#322](https://github.com/logstash-plugins/logstash-input-file/pull/322)
3
+
1
4
  ## 4.4.5
2
5
  - Handle EOF when checking archive validity [#321](https://github.com/logstash-plugins/logstash-input-file/pull/321)
3
6
 
@@ -54,6 +54,7 @@ module FileWatch module ReadMode module Handlers
54
54
  # sincedb position is independent from the watched_file bytes_read
55
55
  delta = line.bytesize + @settings.delimiter_byte_size
56
56
  sincedb_collection.increment(watched_file.sincedb_key, delta)
57
+ break if quit?
57
58
  end
58
59
  rescue EOFError => e
59
60
  log_error("controlled_read: eof error reading file", watched_file, e)
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.4.5'
4
+ s.version = '4.4.6'
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"
@@ -181,25 +181,27 @@ describe LogStash::Inputs::File do
181
181
  end
182
182
 
183
183
  context "for a compressed file" do
184
+ let(:tmp_directory) { Stud::Temporary.directory }
185
+ let(:all_files_path) { fixture_dir.join("compressed.*.*") }
186
+ let(:gz_file_path) { fixture_dir.join('compressed.log.gz') }
187
+ let(:gzip_file_path) { fixture_dir.join('compressed.log.gzip') }
188
+ let(:sincedb_path) { ::File.join(tmp_directory, "sincedb.db") }
189
+ let(:log_completed_path) { ::File.join(tmp_directory, "completed.log") }
190
+
184
191
  it "the file is read" do
185
- file_path = fixture_dir.join('compressed.log.gz')
186
- file_path2 = fixture_dir.join('compressed.log.gzip')
187
- FileInput.make_fixture_current(file_path.to_path)
188
- FileInput.make_fixture_current(file_path2.to_path)
189
- tmpfile_path = fixture_dir.join("compressed.*.*")
190
- directory = Stud::Temporary.directory
191
- sincedb_path = ::File.join(directory, "readmode_C_sincedb.txt")
192
- log_completed_path = ::File.join(directory, "C_completed.txt")
192
+ FileInput.make_fixture_current(gz_file_path.to_path)
193
+ FileInput.make_fixture_current(gzip_file_path.to_path)
193
194
 
194
195
  conf = <<-CONFIG
195
196
  input {
196
197
  file {
197
198
  type => "blah"
198
- path => "#{tmpfile_path}"
199
+ path => "#{all_files_path}"
199
200
  sincedb_path => "#{sincedb_path}"
200
201
  mode => "read"
201
202
  file_completed_action => "log"
202
203
  file_completed_log_path => "#{log_completed_path}"
204
+ exit_after_read => true
203
205
  }
204
206
  }
205
207
  CONFIG
@@ -216,17 +218,11 @@ describe LogStash::Inputs::File do
216
218
  end
217
219
 
218
220
  it "the corrupted file is untouched" do
219
- directory = Stud::Temporary.directory
220
- file_path = fixture_dir.join('compressed.log.gz')
221
- corrupted_file_path = ::File.join(directory, 'corrupted.gz')
222
- FileUtils.cp(file_path, corrupted_file_path)
221
+ corrupted_file_path = ::File.join(tmp_directory, 'corrupted.gz')
222
+ FileUtils.cp(gz_file_path, corrupted_file_path)
223
223
 
224
224
  FileInput.corrupt_gzip(corrupted_file_path)
225
225
 
226
- log_completed_path = ::File.join(directory, "C_completed.txt")
227
- f = File.new(log_completed_path, "w")
228
- f.close()
229
-
230
226
  conf = <<-CONFIG
231
227
  input {
232
228
  file {
@@ -236,28 +232,23 @@ describe LogStash::Inputs::File do
236
232
  file_completed_action => "log_and_delete"
237
233
  file_completed_log_path => "#{log_completed_path}"
238
234
  check_archive_validity => true
235
+ exit_after_read => true
239
236
  }
240
237
  }
241
238
  CONFIG
242
239
 
243
- events = input(conf) do |pipeline, queue|
240
+ input(conf) do |pipeline, queue|
244
241
  wait(1)
245
242
  expect(IO.read(log_completed_path)).to be_empty
246
243
  end
247
244
  end
248
245
 
249
246
  it "the truncated file is untouched" do
250
- directory = Stud::Temporary.directory
251
- file_path = fixture_dir.join('compressed.log.gz')
252
- truncated_file_path = ::File.join(directory, 'truncated.gz')
253
- FileUtils.cp(file_path, truncated_file_path)
247
+ truncated_file_path = ::File.join(tmp_directory, 'truncated.gz')
248
+ FileUtils.cp(gz_file_path, truncated_file_path)
254
249
 
255
250
  FileInput.truncate_gzip(truncated_file_path)
256
251
 
257
- log_completed_path = ::File.join(directory, "C_completed.txt")
258
- f = File.new(log_completed_path, "w")
259
- f.close()
260
-
261
252
  conf = <<-CONFIG
262
253
  input {
263
254
  file {
@@ -267,11 +258,12 @@ describe LogStash::Inputs::File do
267
258
  file_completed_action => "log_and_delete"
268
259
  file_completed_log_path => "#{log_completed_path}"
269
260
  check_archive_validity => true
261
+ exit_after_read => true
270
262
  }
271
263
  }
272
264
  CONFIG
273
265
 
274
- events = input(conf) do |pipeline, queue|
266
+ input(conf) do |pipeline, queue|
275
267
  wait(1)
276
268
  expect(IO.read(log_completed_path)).to be_empty
277
269
  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: 4.4.5
4
+ version: 4.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-18 00:00:00.000000000 Z
11
+ date: 2023-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement