logstash-input-file 4.4.4 → 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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/filewatch/read_mode/handlers/read_file.rb +1 -0
- data/lib/filewatch/read_mode/handlers/read_zip_file.rb +2 -2
- data/lib/jars/filewatch-1.0.1.jar +0 -0
- data/logstash-input-file.gemspec +1 -1
- data/spec/helpers/spec_helper.rb +6 -0
- data/spec/inputs/file_read_spec.rb +41 -18
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eabfa7af5953763874689d9cba6691d9184de195e33dbf40425021653e8f3548
|
4
|
+
data.tar.gz: cdca8f6300254f1d32b327194ed5977f85bb47b6912a27170d4bbacae2d6bad8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbbe5f2f43e7ef106a67bc63ebacb71d1312574dbfac8f4566ab4fef400ad751d6be0e258d8eac2358116c6e90584ca0664b2a5d44e0d853d84ff2703f148904
|
7
|
+
data.tar.gz: 4a7f8f7bedc904dc059ffe8acac14da3ff63663b6a4a5e748c8750952e85a5f15dc0024d696c3de5611fd40408e8f7be7d30c8cb0c5ca9ac2f436aab55d8bb4d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
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
|
+
|
4
|
+
## 4.4.5
|
5
|
+
- Handle EOF when checking archive validity [#321](https://github.com/logstash-plugins/logstash-input-file/pull/321)
|
6
|
+
|
1
7
|
## 4.4.4
|
2
8
|
- 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
9
|
|
@@ -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)
|
@@ -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
|
data/logstash-input-file.gemspec
CHANGED
@@ -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
|
+
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"
|
data/spec/helpers/spec_helper.rb
CHANGED
@@ -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
|
-
|
186
|
-
|
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 => "#{
|
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
|
-
|
220
|
-
|
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,11 +232,38 @@ 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
|
-
|
240
|
+
input(conf) do |pipeline, queue|
|
241
|
+
wait(1)
|
242
|
+
expect(IO.read(log_completed_path)).to be_empty
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
it "the truncated file is untouched" do
|
247
|
+
truncated_file_path = ::File.join(tmp_directory, 'truncated.gz')
|
248
|
+
FileUtils.cp(gz_file_path, truncated_file_path)
|
249
|
+
|
250
|
+
FileInput.truncate_gzip(truncated_file_path)
|
251
|
+
|
252
|
+
conf = <<-CONFIG
|
253
|
+
input {
|
254
|
+
file {
|
255
|
+
type => "blah"
|
256
|
+
path => "#{truncated_file_path}"
|
257
|
+
mode => "read"
|
258
|
+
file_completed_action => "log_and_delete"
|
259
|
+
file_completed_log_path => "#{log_completed_path}"
|
260
|
+
check_archive_validity => true
|
261
|
+
exit_after_read => true
|
262
|
+
}
|
263
|
+
}
|
264
|
+
CONFIG
|
265
|
+
|
266
|
+
input(conf) do |pipeline, queue|
|
244
267
|
wait(1)
|
245
268
|
expect(IO.read(log_completed_path)).to be_empty
|
246
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.
|
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:
|
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
|
@@ -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.
|
285
|
+
rubygems_version: 3.2.33
|
286
286
|
signing_key:
|
287
287
|
specification_version: 4
|
288
288
|
summary: Streams events from files
|