logstash-input-s3 3.8.1 → 3.8.2

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: dd11c4e3d6df5c28143a4a67de1dcaddb7f3d9bd7a0921c278d15482634bc676
4
- data.tar.gz: c9687036e353d7a8a71e4d4ec85e497a110ea740b22b6b98173350bcafe8f5b4
3
+ metadata.gz: 1efe9981371c5b8306ef18f09c13fff78558b66ae2ee667bd2c576b8b88218e9
4
+ data.tar.gz: 843c506610bd7ca9c48759cb7339f80e65211c17df9c3a83c8a5ca6fe850f39f
5
5
  SHA512:
6
- metadata.gz: 3e552d9501b11be011db52415f446a00fc7bfe2ecb601a50f3fa5938de1931fadaded204e46626fd530b6779802627e92f7fe56cda6db5b7f88cd5efadfec2a7
7
- data.tar.gz: ed566e40ac8bb1acb29751b222453fa01a315b40a0d3778d23cc024db3d303fd8baf09d287b91f1492d701c007d972032003eb04f2a45c11ab0fe07dff21c77b
6
+ metadata.gz: 0cd8360c8eafce836259fada827ab42fc1972a42cec30bafe4ed7d61bea222bcc3db0c4a1ee19471a3727dffd7e9170ad48c0fe57baff5408e76e5ea60de3d44
7
+ data.tar.gz: 2cdeb2452504940dbd999d838d1abd905108ae748c9efa7ab9788a67b9e79c139f247c360c33393ce742189e27bb3a8763bde1725c95c76145884b0aa7a54039
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.8.2
2
+ - Refactor: read sincedb time once per bucket listing [#233](https://github.com/logstash-plugins/logstash-input-s3/pull/233)
3
+
1
4
  ## 3.8.1
2
5
  - Feat: cast true/false values for additional_settings [#232](https://github.com/logstash-plugins/logstash-input-s3/pull/232)
3
6
 
@@ -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 !sincedb.newer?(log.last_modified)
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)
@@ -464,10 +465,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
464
465
  @sincedb_path = file
465
466
  end
466
467
 
467
- def newer?(date)
468
- date > read
469
- end
470
-
468
+ # @return [Time]
471
469
  def read
472
470
  if ::File.exists?(@sincedb_path)
473
471
  content = ::File.read(@sincedb_path).chomp.strip
@@ -479,7 +477,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
479
477
  end
480
478
 
481
479
  def write(since = nil)
482
- since = Time.now() if since.nil?
480
+ since = Time.now if since.nil?
483
481
  ::File.open(@sincedb_path, 'w') { |file| file.write(since.to_s) }
484
482
  end
485
483
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-s3'
4
- s.version = '3.8.1'
4
+ s.version = '3.8.2'
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"
@@ -195,6 +195,7 @@ describe LogStash::Inputs::S3 do
195
195
  it 'should log that no files were found in the bucket' do
196
196
  plugin = LogStash::Inputs::S3.new(config)
197
197
  plugin.register
198
+ allow(plugin.logger).to receive(:info).with(/Using the provided sincedb_path/, anything)
198
199
  expect(plugin.logger).to receive(:info).with(/No files found/, anything)
199
200
  expect(plugin.list_new_files).to be_empty
200
201
  end
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.8.1
4
+ version: 3.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-13 00:00:00.000000000 Z
11
+ date: 2021-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement