logstash-input-file 4.4.4 → 4.4.5

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: 318b69d75d8239cbc9287eac35038a576c48c8bd106e0841161d95320d262d81
4
- data.tar.gz: 6e15365687edf5a185071708df3c56bdc341e67c76f6c0e4faabb516cf142bd2
3
+ metadata.gz: 063f72c89ee45f05e386433cc55b797597ceed3fbda22f37dc1034275e8e9530
4
+ data.tar.gz: fe76691a8f46897b716aa9dca6a9420896e619d85f1ca1e12181e1b6f0f5765a
5
5
  SHA512:
6
- metadata.gz: 547e151e76062bc384d7e40fdfbc4cc79310d642c60aa0fbc2ff27971b820bb94979f78f3ef2515b2a1cff979bc9052c9202e7250257a1328ca4de97721b5da1
7
- data.tar.gz: 4e6b547db17a8bc96d8741089d5c0d6b93e3169cc6b847a7133d3cbaf3de2b766c21c6683b71f7f8f6fe6150f2568ef160580391a8eee64a5825b6534df61162
6
+ metadata.gz: 9416e24b57cc632d9182fee5d082f6ca58a31da78f97f013fb07af4b877d341508911a8eb418ef782493c0146f9f04a6477471ab5fa180f3398667426b37e098
7
+ data.tar.gz: bdda74f5fd273e5fee2ab9b15bda33491cc6c8afded19b501df97afffcbb14623c698a109d466d430119d88c04be4649a51892fb5a8f9e09f0ad395ec64d64a4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.4.5
2
+ - Handle EOF when checking archive validity [#321](https://github.com/logstash-plugins/logstash-input-file/pull/321)
3
+
1
4
  ## 4.4.4
2
5
  - Fixes gzip file handling in read mode when run on JDK12+, including JDK17 that is bundled with Logstash 8.4+ [#312](https://github.com/logstash-plugins/logstash-input-file/pull/312)
3
6
 
@@ -71,14 +71,14 @@ module FileWatch module ReadMode module Handlers
71
71
 
72
72
  def corrupted?(watched_file)
73
73
  begin
74
+ start = Time.new
74
75
  file_stream = FileInputStream.new(watched_file.path)
75
76
  gzip_stream = GZIPInputStream.new(file_stream)
76
77
  buffer = Java::byte[8192].new
77
- start = Time.new
78
78
  until gzip_stream.read(buffer) == -1
79
79
  end
80
80
  return false
81
- rescue ZipException => e
81
+ rescue ZipException, Java::JavaIo::EOFException => e
82
82
  duration = Time.now - start
83
83
  logger.warn("Detected corrupted archive #{watched_file.path} file won't be processed", :message => e.message,
84
84
  :duration => duration.round(3))
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.4'
4
+ s.version = '4.4.5'
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"
@@ -24,6 +24,12 @@ module FileInput
24
24
  f.close()
25
25
  end
26
26
 
27
+ def self.truncate_gzip(file_path)
28
+ f = File.open(file_path, "ab")
29
+ f.truncate(100)
30
+ f.close()
31
+ end
32
+
27
33
  class TracerBase
28
34
  def initialize
29
35
  @tracer = Concurrent::Array.new
@@ -245,6 +245,37 @@ describe LogStash::Inputs::File do
245
245
  expect(IO.read(log_completed_path)).to be_empty
246
246
  end
247
247
  end
248
+
249
+ 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)
254
+
255
+ FileInput.truncate_gzip(truncated_file_path)
256
+
257
+ log_completed_path = ::File.join(directory, "C_completed.txt")
258
+ f = File.new(log_completed_path, "w")
259
+ f.close()
260
+
261
+ conf = <<-CONFIG
262
+ input {
263
+ file {
264
+ type => "blah"
265
+ path => "#{truncated_file_path}"
266
+ mode => "read"
267
+ file_completed_action => "log_and_delete"
268
+ file_completed_log_path => "#{log_completed_path}"
269
+ check_archive_validity => true
270
+ }
271
+ }
272
+ CONFIG
273
+
274
+ events = input(conf) do |pipeline, queue|
275
+ wait(1)
276
+ expect(IO.read(log_completed_path)).to be_empty
277
+ end
278
+ end
248
279
  end
249
280
  end
250
281
 
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.4
4
+ version: 4.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-20 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -282,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
282
  - !ruby/object:Gem::Version
283
283
  version: '0'
284
284
  requirements: []
285
- rubygems_version: 3.1.6
285
+ rubygems_version: 3.2.33
286
286
  signing_key:
287
287
  specification_version: 4
288
288
  summary: Streams events from files