logstash-input-file 4.4.3 → 4.4.5

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
  SHA256:
3
- metadata.gz: 26577b41ecc7118c3f4ec2dba011fe730e44d4a74c0f45b19875ba331922bb24
4
- data.tar.gz: e799e9a5e149662f3e1ffa4e902bb8c789d8d5eb7f1b90c1776445571b358a1b
3
+ metadata.gz: 063f72c89ee45f05e386433cc55b797597ceed3fbda22f37dc1034275e8e9530
4
+ data.tar.gz: fe76691a8f46897b716aa9dca6a9420896e619d85f1ca1e12181e1b6f0f5765a
5
5
  SHA512:
6
- metadata.gz: b8ce5e67051bb9d04947d3b3e72475f2929cecf475a5aa1196556fb63fcd37c44e931ebdff1e47fa21f01030bf2a5b15a6301658dbc249633b613c681b942fd9
7
- data.tar.gz: 44dc2403a6ca1dcc5c0660404e4419d5acd1f020d376cd3be8fc7d46533335c10ba10e6c0510eb9c4afa3685b281e5a4a8cfb201ac2882c500f42b3bd54681ef
6
+ metadata.gz: 9416e24b57cc632d9182fee5d082f6ca58a31da78f97f013fb07af4b877d341508911a8eb418ef782493c0146f9f04a6477471ab5fa180f3398667426b37e098
7
+ data.tar.gz: bdda74f5fd273e5fee2ab9b15bda33491cc6c8afded19b501df97afffcbb14623c698a109d466d430119d88c04be4649a51892fb5a8f9e09f0ad395ec64d64a4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 4.4.5
2
+ - Handle EOF when checking archive validity [#321](https://github.com/logstash-plugins/logstash-input-file/pull/321)
3
+
4
+ ## 4.4.4
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)
6
+
1
7
  ## 4.4.3
2
8
  - Fixes read mode to restart the read from reference stored in sincedb in case the file wasn't completely consumed. [#307](https://github.com/logstash-plugins/logstash-input-file/pull/307)
3
9
 
data/docs/index.asciidoc CHANGED
@@ -9,11 +9,6 @@ START - GENERATED VARIABLES, DO NOT EDIT!
9
9
  :release_date: %RELEASE_DATE%
10
10
  :changelog_url: %CHANGELOG_URL%
11
11
  :include_path: ../../../../logstash/docs/include
12
-
13
- ifeval::["{versioned_docs}"=="true"]
14
- :branch: %BRANCH%
15
- :ecs_version: %ECS_VERSION%
16
- endif::[]
17
12
  ///////////////////////////////////////////
18
13
  END - GENERATED VARIABLES, DO NOT EDIT!
19
14
  ///////////////////////////////////////////
@@ -538,9 +533,4 @@ Supported values: `us` `usec` `usecs`, e.g. "600 us", "800 usec", "900 usecs"
538
533
  [NOTE]
539
534
  `micro` `micros` and `microseconds` are not supported
540
535
 
541
- ifeval::["{versioned_docs}"=="true"]
542
- :branch: current
543
- :ecs_version: current
544
- endif::[]
545
-
546
536
  :default_codec!:
@@ -29,7 +29,7 @@ module FileWatch module ReadMode module Handlers
29
29
  gzip_stream = GZIPInputStream.new(file_stream)
30
30
  decoder = InputStreamReader.new(gzip_stream, "UTF-8")
31
31
  buffered = BufferedReader.new(decoder)
32
- while (line = buffered.readLine(false))
32
+ while (line = buffered.readLine())
33
33
  watched_file.listener.accept(line)
34
34
  # can't quit, if we did then we would incorrectly write a 'completed' sincedb entry
35
35
  # what do we do about quit when we have just begun reading the zipped file (e.g. pipeline reloading)
@@ -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.3'
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.3
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-06-06 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