logstash-input-file 4.4.5 → 4.4.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 -0
- data/lib/filewatch/read_mode/handlers/read_file.rb +1 -0
- data/lib/jars/filewatch-1.0.1.jar +0 -0
- data/logstash-input-file.gemspec +1 -1
- data/spec/filewatch/buftok_spec.rb +4 -4
- data/spec/helpers/spec_helper.rb +17 -0
- data/spec/inputs/file_read_spec.rb +19 -27
- metadata +27 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45943ffe3b08260710657d17a321d0129e1c836f8840473297813753dc359436
|
|
4
|
+
data.tar.gz: 5792827bd08cbbfc22ba53f70b1d41db69d90c00bf97fbd13878198743117aee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3efb12ff1e4074c2a4d61052f126dc28759189c019b6ef1013b3363a64bb6b9b4b61dec477cef6bf4332709b3e843abfc705a97eb9f2e2b24872eec8fcb82883
|
|
7
|
+
data.tar.gz: 3e391cba34af69e98c0300a7cd16289275648d49904e3d2518ce225a6551f606d4c091c011ce16eefef74a1c1789e14ce032c900ac57f4fce0c908d0057d31ce
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 4.4.7
|
|
2
|
+
- Re-packaging the plugin [#331](https://github.com/logstash-plugins/logstash-input-file/pull/331)
|
|
3
|
+
|
|
4
|
+
## 4.4.6
|
|
5
|
+
- Change read mode to immediately stop consuming buffered lines when shutdown is requested [#322](https://github.com/logstash-plugins/logstash-input-file/pull/322)
|
|
6
|
+
|
|
1
7
|
## 4.4.5
|
|
2
8
|
- Handle EOF when checking archive validity [#321](https://github.com/logstash-plugins/logstash-input-file/pull/321)
|
|
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)
|
|
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.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"
|
|
@@ -5,13 +5,13 @@ describe FileWatch::BufferedTokenizer do
|
|
|
5
5
|
|
|
6
6
|
context "when using the default delimiter" do
|
|
7
7
|
it "splits the lines correctly" do
|
|
8
|
-
expect(subject.extract("hello\nworld\n")).to eq ["hello", "world"]
|
|
8
|
+
expect(subject.extract("hello\nworld\n").to_a).to eq ["hello", "world"]
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it "holds partial lines back until a token is found" do
|
|
12
12
|
buffer = described_class.new
|
|
13
|
-
expect(buffer.extract("hello\nwor")).to eq ["hello"]
|
|
14
|
-
expect(buffer.extract("ld\n")).to eq ["world"]
|
|
13
|
+
expect(buffer.extract("hello\nwor").to_a).to eq ["hello"]
|
|
14
|
+
expect(buffer.extract("ld\n").to_a).to eq ["world"]
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ describe FileWatch::BufferedTokenizer do
|
|
|
19
19
|
subject { FileWatch::BufferedTokenizer.new("\r\n") }
|
|
20
20
|
|
|
21
21
|
it "splits the lines correctly" do
|
|
22
|
-
expect(subject.extract("hello\r\nworld\r\n")).to eq ["hello", "world"]
|
|
22
|
+
expect(subject.extract("hello\r\nworld\r\n").to_a).to eq ["hello", "world"]
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
end
|
data/spec/helpers/spec_helper.rb
CHANGED
|
@@ -51,7 +51,24 @@ module FileInput
|
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
class NullObject
|
|
55
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
56
|
+
true
|
|
57
|
+
end
|
|
58
|
+
def method_missing(method_name, *args, **kwargs, &block)
|
|
59
|
+
nil
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
module MockLoggable
|
|
64
|
+
def self.included(base)
|
|
65
|
+
mock_logger = NullObject.new
|
|
66
|
+
base.define_method(:logger) { mock_logger }
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
54
70
|
class CodecTracer < TracerBase
|
|
71
|
+
include MockLoggable
|
|
55
72
|
def decode_accept(ctx, data, listener)
|
|
56
73
|
@tracer.push [:decode_accept, [ctx, data]]
|
|
57
74
|
listener.process(ctx, {"message" => data})
|
|
@@ -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,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
|
-
|
|
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
|
-
|
|
251
|
-
|
|
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
|
-
|
|
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,16 +1,16 @@
|
|
|
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.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elastic
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-01-31 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: logstash-core-plugin-api
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
@@ -19,9 +19,8 @@ dependencies:
|
|
|
19
19
|
- - "<="
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
21
|
version: '2.99'
|
|
22
|
-
name: logstash-core-plugin-api
|
|
23
|
-
prerelease: false
|
|
24
22
|
type: :runtime
|
|
23
|
+
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
@@ -31,154 +30,154 @@ dependencies:
|
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
31
|
version: '2.99'
|
|
33
32
|
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: logstash-codec-plain
|
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
|
35
35
|
requirements:
|
|
36
36
|
- - ">="
|
|
37
37
|
- !ruby/object:Gem::Version
|
|
38
38
|
version: '0'
|
|
39
|
-
name: logstash-codec-plain
|
|
40
|
-
prerelease: false
|
|
41
39
|
type: :runtime
|
|
40
|
+
prerelease: false
|
|
42
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
42
|
requirements:
|
|
44
43
|
- - ">="
|
|
45
44
|
- !ruby/object:Gem::Version
|
|
46
45
|
version: '0'
|
|
47
46
|
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: addressable
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
49
49
|
requirements:
|
|
50
50
|
- - ">="
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
52
|
version: '0'
|
|
53
|
-
name: addressable
|
|
54
|
-
prerelease: false
|
|
55
53
|
type: :runtime
|
|
54
|
+
prerelease: false
|
|
56
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
56
|
requirements:
|
|
58
57
|
- - ">="
|
|
59
58
|
- !ruby/object:Gem::Version
|
|
60
59
|
version: '0'
|
|
61
60
|
- !ruby/object:Gem::Dependency
|
|
61
|
+
name: concurrent-ruby
|
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
|
63
63
|
requirements:
|
|
64
64
|
- - "~>"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
66
|
version: '1.0'
|
|
67
|
-
name: concurrent-ruby
|
|
68
|
-
prerelease: false
|
|
69
67
|
type: :runtime
|
|
68
|
+
prerelease: false
|
|
70
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
70
|
requirements:
|
|
72
71
|
- - "~>"
|
|
73
72
|
- !ruby/object:Gem::Version
|
|
74
73
|
version: '1.0'
|
|
75
74
|
- !ruby/object:Gem::Dependency
|
|
75
|
+
name: logstash-codec-multiline
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
|
78
78
|
- - "~>"
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
80
|
version: '3.0'
|
|
81
|
-
name: logstash-codec-multiline
|
|
82
|
-
prerelease: false
|
|
83
81
|
type: :runtime
|
|
82
|
+
prerelease: false
|
|
84
83
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
84
|
requirements:
|
|
86
85
|
- - "~>"
|
|
87
86
|
- !ruby/object:Gem::Version
|
|
88
87
|
version: '3.0'
|
|
89
88
|
- !ruby/object:Gem::Dependency
|
|
89
|
+
name: logstash-mixin-ecs_compatibility_support
|
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
|
91
91
|
requirements:
|
|
92
92
|
- - "~>"
|
|
93
93
|
- !ruby/object:Gem::Version
|
|
94
94
|
version: '1.3'
|
|
95
|
-
name: logstash-mixin-ecs_compatibility_support
|
|
96
|
-
prerelease: false
|
|
97
95
|
type: :runtime
|
|
96
|
+
prerelease: false
|
|
98
97
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
98
|
requirements:
|
|
100
99
|
- - "~>"
|
|
101
100
|
- !ruby/object:Gem::Version
|
|
102
101
|
version: '1.3'
|
|
103
102
|
- !ruby/object:Gem::Dependency
|
|
103
|
+
name: stud
|
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
|
106
106
|
- - "~>"
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
108
|
version: 0.0.19
|
|
109
|
-
name: stud
|
|
110
|
-
prerelease: false
|
|
111
109
|
type: :development
|
|
110
|
+
prerelease: false
|
|
112
111
|
version_requirements: !ruby/object:Gem::Requirement
|
|
113
112
|
requirements:
|
|
114
113
|
- - "~>"
|
|
115
114
|
- !ruby/object:Gem::Version
|
|
116
115
|
version: 0.0.19
|
|
117
116
|
- !ruby/object:Gem::Dependency
|
|
117
|
+
name: logstash-devutils
|
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements:
|
|
120
120
|
- - ">="
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
122
|
version: '0'
|
|
123
|
-
name: logstash-devutils
|
|
124
|
-
prerelease: false
|
|
125
123
|
type: :development
|
|
124
|
+
prerelease: false
|
|
126
125
|
version_requirements: !ruby/object:Gem::Requirement
|
|
127
126
|
requirements:
|
|
128
127
|
- - ">="
|
|
129
128
|
- !ruby/object:Gem::Version
|
|
130
129
|
version: '0'
|
|
131
130
|
- !ruby/object:Gem::Dependency
|
|
131
|
+
name: logstash-codec-json
|
|
132
132
|
requirement: !ruby/object:Gem::Requirement
|
|
133
133
|
requirements:
|
|
134
134
|
- - ">="
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
136
|
version: '0'
|
|
137
|
-
name: logstash-codec-json
|
|
138
|
-
prerelease: false
|
|
139
137
|
type: :development
|
|
138
|
+
prerelease: false
|
|
140
139
|
version_requirements: !ruby/object:Gem::Requirement
|
|
141
140
|
requirements:
|
|
142
141
|
- - ">="
|
|
143
142
|
- !ruby/object:Gem::Version
|
|
144
143
|
version: '0'
|
|
145
144
|
- !ruby/object:Gem::Dependency
|
|
145
|
+
name: rspec-sequencing
|
|
146
146
|
requirement: !ruby/object:Gem::Requirement
|
|
147
147
|
requirements:
|
|
148
148
|
- - ">="
|
|
149
149
|
- !ruby/object:Gem::Version
|
|
150
150
|
version: '0'
|
|
151
|
-
name: rspec-sequencing
|
|
152
|
-
prerelease: false
|
|
153
151
|
type: :development
|
|
152
|
+
prerelease: false
|
|
154
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
155
154
|
requirements:
|
|
156
155
|
- - ">="
|
|
157
156
|
- !ruby/object:Gem::Version
|
|
158
157
|
version: '0'
|
|
159
158
|
- !ruby/object:Gem::Dependency
|
|
159
|
+
name: rspec-wait
|
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
|
161
161
|
requirements:
|
|
162
162
|
- - ">="
|
|
163
163
|
- !ruby/object:Gem::Version
|
|
164
164
|
version: '0'
|
|
165
|
-
name: rspec-wait
|
|
166
|
-
prerelease: false
|
|
167
165
|
type: :development
|
|
166
|
+
prerelease: false
|
|
168
167
|
version_requirements: !ruby/object:Gem::Requirement
|
|
169
168
|
requirements:
|
|
170
169
|
- - ">="
|
|
171
170
|
- !ruby/object:Gem::Version
|
|
172
171
|
version: '0'
|
|
173
172
|
- !ruby/object:Gem::Dependency
|
|
173
|
+
name: timecop
|
|
174
174
|
requirement: !ruby/object:Gem::Requirement
|
|
175
175
|
requirements:
|
|
176
176
|
- - ">="
|
|
177
177
|
- !ruby/object:Gem::Version
|
|
178
178
|
version: '0'
|
|
179
|
-
name: timecop
|
|
180
|
-
prerelease: false
|
|
181
179
|
type: :development
|
|
180
|
+
prerelease: false
|
|
182
181
|
version_requirements: !ruby/object:Gem::Requirement
|
|
183
182
|
requirements:
|
|
184
183
|
- - ">="
|
|
@@ -267,7 +266,6 @@ licenses:
|
|
|
267
266
|
metadata:
|
|
268
267
|
logstash_plugin: 'true'
|
|
269
268
|
logstash_group: input
|
|
270
|
-
post_install_message:
|
|
271
269
|
rdoc_options: []
|
|
272
270
|
require_paths:
|
|
273
271
|
- lib
|
|
@@ -282,8 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
282
280
|
- !ruby/object:Gem::Version
|
|
283
281
|
version: '0'
|
|
284
282
|
requirements: []
|
|
285
|
-
rubygems_version: 3.
|
|
286
|
-
signing_key:
|
|
283
|
+
rubygems_version: 3.6.3
|
|
287
284
|
specification_version: 4
|
|
288
285
|
summary: Streams events from files
|
|
289
286
|
test_files:
|