logstash-input-file 4.1.6 → 4.1.7
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 -1
- data/lib/filewatch/discoverer.rb +1 -1
- data/lib/filewatch/read_mode/processor.rb +2 -0
- data/lib/filewatch/tail_mode/processor.rb +6 -4
- data/lib/filewatch/watched_file.rb +0 -6
- data/lib/jars/filewatch-1.0.1.jar +0 -0
- data/logstash-input-file.gemspec +1 -1
- data/spec/filewatch/rotate_spec.rb +45 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 452117d6e30aa2df0ee9aa1f7c663a4bed00569489a53ba479f8b68789bb9051
|
4
|
+
data.tar.gz: 1724d57ff775ed4df8ef3821cafdb044163a8b6c246269269db4e7ef7d1bbe00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 555004eb3d45f7042703e1adc61b027a009baef5578ee6d3e4d22318c0a26244c47da571b68f55041851e82b305dbfcb7fd08d4888e4f85ca95cce63627b3d51
|
7
|
+
data.tar.gz: 7a4988cf0671f09eb1e37ed007adbee6aeb3f097f449e6246f04ac9e40dde80139343b0ae1f5321fd94f540b15b05e2dee676d208b0c71b944e8a9512ae985e2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 4.1.7
|
2
|
+
- Fixed problem in rotation handling where the target file being rotated was
|
3
|
+
subjected to the start_position setting when it must always start from the beginning.
|
4
|
+
[Issue #214](https://github.com/logstash-plugins/logstash-input-file/issues/214)
|
5
|
+
|
1
6
|
## 4.1.6
|
2
7
|
- Fixed Errno::ENOENT exception in Discoverer. [Issue #204](https://github.com/logstash-plugins/logstash-input-file/issues/204)
|
3
8
|
|
@@ -15,7 +20,7 @@
|
|
15
20
|
was possible to read into memory allocated but not filled with data resulting
|
16
21
|
in ASCII NUL (0) bytes in the message field. Now, files are read up to the
|
17
22
|
size as given by the remote filesystem client. Applies to tail and read modes.
|
18
|
-
|
23
|
+
|
19
24
|
## 4.1.3
|
20
25
|
- Fixed `read` mode of regular files sincedb write is requested in each read loop
|
21
26
|
iteration rather than waiting for the end-of-file to be reached. Note: for gz files,
|
data/lib/filewatch/discoverer.rb
CHANGED
@@ -56,7 +56,7 @@ module FileWatch
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def discover_any_files(path, ongoing)
|
59
|
-
fileset = Dir.glob(path).select{|f| File.file?(f)
|
59
|
+
fileset = Dir.glob(path).select{|f| File.file?(f)}
|
60
60
|
logger.trace("discover_files", "count" => fileset.size)
|
61
61
|
fileset.each do |file|
|
62
62
|
pathname = Pathname.new(file)
|
@@ -168,14 +168,16 @@ module FileWatch module TailMode
|
|
168
168
|
potential_sdb_value = @sincedb_collection.get(potential_key)
|
169
169
|
logger.trace(">>> Rotation In Progress", "watched_file" => watched_file.details, "found_sdb_value" => sdb_value, "potential_key" => potential_key, "potential_sdb_value" => potential_sdb_value)
|
170
170
|
if potential_sdb_value.nil?
|
171
|
+
logger.trace("---------- >>>> Rotation In Progress: rotating as existing file")
|
172
|
+
watched_file.rotate_as_file
|
173
|
+
trace_message = "---------- >>>> Rotation In Progress: no potential sincedb value "
|
171
174
|
if sdb_value.nil?
|
172
|
-
|
173
|
-
watched_file.rotate_as_initial_file
|
175
|
+
trace_message.concat("AND no found sincedb value")
|
174
176
|
else
|
175
|
-
|
176
|
-
watched_file.rotate_as_file
|
177
|
+
trace_message.concat("BUT found sincedb value")
|
177
178
|
sdb_value.clear_watched_file
|
178
179
|
end
|
180
|
+
logger.trace(trace_message)
|
179
181
|
new_sdb_value = SincedbValue.new(0)
|
180
182
|
new_sdb_value.set_watched_file(watched_file)
|
181
183
|
@sincedb_collection.set(potential_key, new_sdb_value)
|
@@ -76,12 +76,6 @@ module FileWatch
|
|
76
76
|
@sdb_key_v1 = @stat.inode_struct
|
77
77
|
end
|
78
78
|
|
79
|
-
def rotate_as_initial_file
|
80
|
-
# rotation, when no sincedb record exists for new inode - we have never seen this inode before.
|
81
|
-
rotate_as_file
|
82
|
-
@initial = true
|
83
|
-
end
|
84
|
-
|
85
79
|
def rotate_as_file(bytes_read = 0)
|
86
80
|
# rotation, when a sincedb record exists for new inode, but no watched file to rotate from
|
87
81
|
# probably caused by a deletion detected in the middle of the rename cascade
|
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.1.
|
4
|
+
s.version = '4.1.7'
|
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"
|
@@ -28,7 +28,7 @@ module FileWatch
|
|
28
28
|
let(:max) { 4095 }
|
29
29
|
let(:stat_interval) { 0.01 }
|
30
30
|
let(:discover_interval) { 15 }
|
31
|
-
let(:start_new_files_at) { :
|
31
|
+
let(:start_new_files_at) { :end }
|
32
32
|
let(:sincedb_path) { directory.join("tailing.sdb") }
|
33
33
|
let(:opts) do
|
34
34
|
{
|
@@ -447,5 +447,49 @@ module FileWatch
|
|
447
447
|
expect(listener3.lines.size).to eq(0)
|
448
448
|
end
|
449
449
|
end
|
450
|
+
|
451
|
+
context "? rotation: when an active file is renamed inside the glob - issue 214" do
|
452
|
+
let(:watch_dir) { directory.join("*L.log") }
|
453
|
+
let(:file_path) { directory.join("1L.log") }
|
454
|
+
let(:second_file) { directory.join("2L.log") }
|
455
|
+
subject { described_class.new(conf) }
|
456
|
+
let(:listener1) { observer.listener_for(file1_path) }
|
457
|
+
let(:listener2) { observer.listener_for(second_file.to_path) }
|
458
|
+
let(:stat_interval) { 0.25 }
|
459
|
+
let(:discover_interval) { 1 }
|
460
|
+
let(:line4) { "Line 4 - Some other non lorem ipsum content" }
|
461
|
+
let(:actions) do
|
462
|
+
RSpec::Sequencing
|
463
|
+
.run_after(0.75, "create file") do
|
464
|
+
file_path.open("wb") { |file| file.puts(line1); file.puts(line2) }
|
465
|
+
end
|
466
|
+
.then_after(0.5, "rename") do
|
467
|
+
file_path.rename(second_file)
|
468
|
+
file_path.open("wb") { |file| file.puts("#{line3}") }
|
469
|
+
end
|
470
|
+
.then("wait for expectations to be met") do
|
471
|
+
wait(2.0).for{listener1.lines.size + listener2.lines.size}.to eq(3)
|
472
|
+
end
|
473
|
+
.then_after(0.5, "rename again") do
|
474
|
+
file_path.rename(second_file)
|
475
|
+
file_path.open("wb") { |file| file.puts("#{line4}") }
|
476
|
+
end
|
477
|
+
.then("wait for expectations to be met") do
|
478
|
+
wait(2.0).for{listener1.lines.size + listener2.lines.size}.to eq(4)
|
479
|
+
end
|
480
|
+
.then("quit") do
|
481
|
+
tailing.quit
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
it "content is read correctly, the renamed file is not reread from scratch" do
|
486
|
+
actions.activate_quietly
|
487
|
+
tailing.watch_this(watch_dir.to_path)
|
488
|
+
tailing.subscribe(observer)
|
489
|
+
actions.assert_no_errors
|
490
|
+
expect(listener1.lines).to eq([line1, line2, line3, line4])
|
491
|
+
expect(listener2.lines).to eq([])
|
492
|
+
end
|
493
|
+
end
|
450
494
|
end
|
451
495
|
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.1.
|
4
|
+
version: 4.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|