logstash-input-s3 3.7.0 → 3.8.3
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 +12 -0
- data/docs/index.asciidoc +1 -1
- data/lib/logstash/inputs/s3.rb +37 -27
- data/logstash-input-s3.gemspec +2 -2
- data/spec/inputs/s3_spec.rb +8 -4
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 584ac32b0d4a7d0c3d478b90ad92d3170d5926d6d802d46b31a5075fc7bd27e9
|
|
4
|
+
data.tar.gz: 2a24ecd946ce52b6aa29acf3352314a26750c9b1350f33ecd685f0e206cd5d4a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c306fb6d68a0b58cbb109508590d07cbd9cca9b67534e039c2fad2cc033e8756bdddd2ecde0f9177e8faf2ec65e4fb84f8b2e6576d65742d32f0867da0ab10b0
|
|
7
|
+
data.tar.gz: 293e978d3301e7d545927daa5a087bc433bf948d18662bf97cfb164dd59928c7e58719b6dcc7ede1fbed6c5d9b519c416ff44a043a5fd130123a1bf64d86231e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 3.8.3
|
|
2
|
+
- Fix missing `metadata` and `type` of the last event [#223](https://github.com/logstash-plugins/logstash-input-s3/pull/223)
|
|
3
|
+
|
|
4
|
+
## 3.8.2
|
|
5
|
+
- Refactor: read sincedb time once per bucket listing [#233](https://github.com/logstash-plugins/logstash-input-s3/pull/233)
|
|
6
|
+
|
|
7
|
+
## 3.8.1
|
|
8
|
+
- Feat: cast true/false values for additional_settings [#232](https://github.com/logstash-plugins/logstash-input-s3/pull/232)
|
|
9
|
+
|
|
10
|
+
## 3.8.0
|
|
11
|
+
- Add ECS v8 support.
|
|
12
|
+
|
|
1
13
|
## 3.7.0
|
|
2
14
|
- Add ECS support. [#228](https://github.com/logstash-plugins/logstash-input-s3/pull/228)
|
|
3
15
|
- Fix missing file in cutoff time change. [#224](https://github.com/logstash-plugins/logstash-input-s3/pull/224)
|
data/docs/index.asciidoc
CHANGED
|
@@ -189,7 +189,7 @@ Whether to delete processed files from the original bucket.
|
|
|
189
189
|
* Value type is <<string,string>>
|
|
190
190
|
* Supported values are:
|
|
191
191
|
** `disabled`: does not use ECS-compatible field names
|
|
192
|
-
** `v1`: uses metadata fields that are compatible with Elastic Common Schema
|
|
192
|
+
** `v1`,`v8`: uses metadata fields that are compatible with Elastic Common Schema
|
|
193
193
|
|
|
194
194
|
Controls this plugin's compatibility with the
|
|
195
195
|
{ecs-ref}[Elastic Common Schema (ECS)].
|
data/lib/logstash/inputs/s3.rb
CHANGED
|
@@ -28,7 +28,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
|
|
|
28
28
|
java_import java.util.zip.ZipException
|
|
29
29
|
|
|
30
30
|
include LogStash::PluginMixins::AwsConfig::V2
|
|
31
|
-
include LogStash::PluginMixins::ECSCompatibilitySupport(:disabled, :v1)
|
|
31
|
+
include LogStash::PluginMixins::ECSCompatibilitySupport(:disabled, :v1, :v8 => :v1)
|
|
32
32
|
|
|
33
33
|
config_name "s3"
|
|
34
34
|
|
|
@@ -139,6 +139,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
|
|
|
139
139
|
objects = []
|
|
140
140
|
found = false
|
|
141
141
|
current_time = Time.now
|
|
142
|
+
sincedb_time = sincedb.read
|
|
142
143
|
begin
|
|
143
144
|
@s3bucket.objects(:prefix => @prefix).each do |log|
|
|
144
145
|
found = true
|
|
@@ -147,7 +148,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
|
|
|
147
148
|
@logger.debug('Ignoring', :key => log.key)
|
|
148
149
|
elsif log.content_length <= 0
|
|
149
150
|
@logger.debug('Object Zero Length', :key => log.key)
|
|
150
|
-
elsif
|
|
151
|
+
elsif log.last_modified <= sincedb_time
|
|
151
152
|
@logger.debug('Object Not Modified', :key => log.key)
|
|
152
153
|
elsif log.last_modified > (current_time - CUTOFF_SECOND).utc # file modified within last two seconds will be processed in next cycle
|
|
153
154
|
@logger.debug('Object Modified After Cutoff Time', :key => log.key)
|
|
@@ -234,30 +235,34 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
|
|
|
234
235
|
@logger.debug('Event is metadata, updating the current cloudfront metadata', :event => event)
|
|
235
236
|
update_metadata(metadata, event)
|
|
236
237
|
else
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if @include_object_properties
|
|
240
|
-
event.set("[@metadata][s3]", object.data.to_h)
|
|
241
|
-
else
|
|
242
|
-
event.set("[@metadata][s3]", {})
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
event.set("[@metadata][s3][key]", object.key)
|
|
246
|
-
event.set(@cloudfront_version_key, metadata[:cloudfront_version]) unless metadata[:cloudfront_version].nil?
|
|
247
|
-
event.set(@cloudfront_fields_key, metadata[:cloudfront_fields]) unless metadata[:cloudfront_fields].nil?
|
|
248
|
-
|
|
249
|
-
queue << event
|
|
238
|
+
push_decoded_event(queue, metadata, object, event)
|
|
250
239
|
end
|
|
251
240
|
end
|
|
252
241
|
end
|
|
253
242
|
# #ensure any stateful codecs (such as multi-line ) are flushed to the queue
|
|
254
243
|
@codec.flush do |event|
|
|
255
|
-
queue
|
|
244
|
+
push_decoded_event(queue, metadata, object, event)
|
|
256
245
|
end
|
|
257
246
|
|
|
258
247
|
return true
|
|
259
248
|
end # def process_local_log
|
|
260
249
|
|
|
250
|
+
def push_decoded_event(queue, metadata, object, event)
|
|
251
|
+
decorate(event)
|
|
252
|
+
|
|
253
|
+
if @include_object_properties
|
|
254
|
+
event.set("[@metadata][s3]", object.data.to_h)
|
|
255
|
+
else
|
|
256
|
+
event.set("[@metadata][s3]", {})
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
event.set("[@metadata][s3][key]", object.key)
|
|
260
|
+
event.set(@cloudfront_version_key, metadata[:cloudfront_version]) unless metadata[:cloudfront_version].nil?
|
|
261
|
+
event.set(@cloudfront_fields_key, metadata[:cloudfront_fields]) unless metadata[:cloudfront_fields].nil?
|
|
262
|
+
|
|
263
|
+
queue << event
|
|
264
|
+
end
|
|
265
|
+
|
|
261
266
|
def event_is_metadata?(event)
|
|
262
267
|
return false unless event.get("message").class == String
|
|
263
268
|
line = event.get("message")
|
|
@@ -353,14 +358,22 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
|
|
|
353
358
|
end
|
|
354
359
|
|
|
355
360
|
def symbolized_settings
|
|
356
|
-
@symbolized_settings ||=
|
|
361
|
+
@symbolized_settings ||= symbolize_keys_and_cast_true_false(@additional_settings)
|
|
357
362
|
end
|
|
358
363
|
|
|
359
|
-
def
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
+
def symbolize_keys_and_cast_true_false(hash)
|
|
365
|
+
case hash
|
|
366
|
+
when Hash
|
|
367
|
+
symbolized = {}
|
|
368
|
+
hash.each { |key, value| symbolized[key.to_sym] = symbolize_keys_and_cast_true_false(value) }
|
|
369
|
+
symbolized
|
|
370
|
+
when 'true'
|
|
371
|
+
true
|
|
372
|
+
when 'false'
|
|
373
|
+
false
|
|
374
|
+
else
|
|
375
|
+
hash
|
|
376
|
+
end
|
|
364
377
|
end
|
|
365
378
|
|
|
366
379
|
def ignore_filename?(filename)
|
|
@@ -456,10 +469,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
|
|
|
456
469
|
@sincedb_path = file
|
|
457
470
|
end
|
|
458
471
|
|
|
459
|
-
|
|
460
|
-
date > read
|
|
461
|
-
end
|
|
462
|
-
|
|
472
|
+
# @return [Time]
|
|
463
473
|
def read
|
|
464
474
|
if ::File.exists?(@sincedb_path)
|
|
465
475
|
content = ::File.read(@sincedb_path).chomp.strip
|
|
@@ -471,7 +481,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
|
|
|
471
481
|
end
|
|
472
482
|
|
|
473
483
|
def write(since = nil)
|
|
474
|
-
since = Time.now
|
|
484
|
+
since = Time.now if since.nil?
|
|
475
485
|
::File.open(@sincedb_path, 'w') { |file| file.write(since.to_s) }
|
|
476
486
|
end
|
|
477
487
|
end
|
data/logstash-input-s3.gemspec
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
|
|
3
3
|
s.name = 'logstash-input-s3'
|
|
4
|
-
s.version = '3.
|
|
4
|
+
s.version = '3.8.3'
|
|
5
5
|
s.licenses = ['Apache-2.0']
|
|
6
6
|
s.summary = "Streams events from files in a S3 bucket"
|
|
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"
|
|
@@ -27,5 +27,5 @@ Gem::Specification.new do |s|
|
|
|
27
27
|
s.add_development_dependency 'logstash-devutils'
|
|
28
28
|
s.add_development_dependency "logstash-codec-json"
|
|
29
29
|
s.add_development_dependency "logstash-codec-multiline"
|
|
30
|
-
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.
|
|
30
|
+
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.2'
|
|
31
31
|
end
|
data/spec/inputs/s3_spec.rb
CHANGED
|
@@ -42,7 +42,9 @@ describe LogStash::Inputs::S3 do
|
|
|
42
42
|
expect_any_instance_of(LogStash::Inputs::S3).to receive(:list_new_files).and_return(TestInfiniteS3Object.new(s3_obj))
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
it_behaves_like "an interruptible input plugin"
|
|
45
|
+
it_behaves_like "an interruptible input plugin" do
|
|
46
|
+
let(:allowed_lag) { 16 } if LOGSTASH_VERSION.split('.').first.to_i <= 6
|
|
47
|
+
end
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
describe "#register" do
|
|
@@ -82,10 +84,10 @@ describe LogStash::Inputs::S3 do
|
|
|
82
84
|
end
|
|
83
85
|
|
|
84
86
|
describe "additional_settings" do
|
|
85
|
-
context
|
|
87
|
+
context "supported settings" do
|
|
86
88
|
let(:settings) {
|
|
87
89
|
{
|
|
88
|
-
"additional_settings" => { "force_path_style" => true },
|
|
90
|
+
"additional_settings" => { "force_path_style" => 'true', "ssl_verify_peer" => 'false', "profile" => 'logstash' },
|
|
89
91
|
"bucket" => "logstash-test",
|
|
90
92
|
}
|
|
91
93
|
}
|
|
@@ -93,7 +95,7 @@ describe LogStash::Inputs::S3 do
|
|
|
93
95
|
it 'should instantiate AWS::S3 clients with force_path_style set' do
|
|
94
96
|
expect(Aws::S3::Resource).to receive(:new).with({
|
|
95
97
|
:region => subject.region,
|
|
96
|
-
:force_path_style => true
|
|
98
|
+
:force_path_style => true, :ssl_verify_peer => false, :profile => 'logstash'
|
|
97
99
|
}).and_call_original
|
|
98
100
|
|
|
99
101
|
subject.send(:get_s3object)
|
|
@@ -193,6 +195,7 @@ describe LogStash::Inputs::S3 do
|
|
|
193
195
|
it 'should log that no files were found in the bucket' do
|
|
194
196
|
plugin = LogStash::Inputs::S3.new(config)
|
|
195
197
|
plugin.register
|
|
198
|
+
allow(plugin.logger).to receive(:info).with(/Using the provided sincedb_path/, anything)
|
|
196
199
|
expect(plugin.logger).to receive(:info).with(/No files found/, anything)
|
|
197
200
|
expect(plugin.list_new_files).to be_empty
|
|
198
201
|
end
|
|
@@ -326,6 +329,7 @@ describe LogStash::Inputs::S3 do
|
|
|
326
329
|
events = fetch_events(config)
|
|
327
330
|
expect(events.size).to eq(events_to_process)
|
|
328
331
|
expect(events[0].get("[@metadata][s3][key]")).to eql log.key
|
|
332
|
+
expect(events[1].get("[@metadata][s3][key]")).to eql log.key
|
|
329
333
|
end
|
|
330
334
|
|
|
331
335
|
it "deletes the temporary file" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-input-s3
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.8.3
|
|
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: 2022-01-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -105,7 +105,7 @@ dependencies:
|
|
|
105
105
|
requirements:
|
|
106
106
|
- - "~>"
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '1.
|
|
108
|
+
version: '1.2'
|
|
109
109
|
name: logstash-mixin-ecs_compatibility_support
|
|
110
110
|
prerelease: false
|
|
111
111
|
type: :runtime
|
|
@@ -113,7 +113,7 @@ dependencies:
|
|
|
113
113
|
requirements:
|
|
114
114
|
- - "~>"
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '1.
|
|
116
|
+
version: '1.2'
|
|
117
117
|
description: This gem is a Logstash plugin required to be installed on top of the
|
|
118
118
|
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
|
119
119
|
gem is not a stand-alone program
|
|
@@ -167,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
167
167
|
- !ruby/object:Gem::Version
|
|
168
168
|
version: '0'
|
|
169
169
|
requirements: []
|
|
170
|
-
|
|
171
|
-
rubygems_version: 2.6.13
|
|
170
|
+
rubygems_version: 3.1.6
|
|
172
171
|
signing_key:
|
|
173
172
|
specification_version: 4
|
|
174
173
|
summary: Streams events from files in a S3 bucket
|