logstash-integration-aws 7.3.2-java → 7.3.4-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1b8a5b5a5fc9020b5c91a867bf8608cc465ca404bcab2e8fbde85e36768aa63
4
- data.tar.gz: 0a5a55593fab48534744b17df0c6ba14b2b63b5d63ea2437a85b40d7421bf9d8
3
+ metadata.gz: 66d4cda26d968b67291bf9864364e51ca118b67646c4145e75d612ee30516b24
4
+ data.tar.gz: f2145daff4c36a702eeed4b4e22e6b4304dfef8ac0d5e3fed50a2dc9d86e94e2
5
5
  SHA512:
6
- metadata.gz: 43bfee142660e88a973349580daae1d933ff17721225e2fe6fd3592ec02306498f359d4497d34f677c17be903c4e521bdd2095ed0ab36da9c7ff5ebce74bba4f
7
- data.tar.gz: d692f03255dd68b9e0d0b6f6d42ef7db17d11e49d116d00ebc761702ad5f36a65e6e1648f8f25c27f58b82576bc57af9b54f2aa8ff7ef9b5359028d260cf8dd2
6
+ metadata.gz: 99debf93aa83e1bd10a638e80e9693f0500139f35f073afe22a2b10d486db88dc2a81a3ad4a566606a4fd0ab333bcdbb99d0efbc2c6f72e7c9165cbbb673ae9a
7
+ data.tar.gz: 3bfe2df657134abe85d4469d77569ba6c823017602576c9e0ddb8d24815b7f44bee89e6277cbad8d072bf9aad4480d8dd1f424a2a1cb4a729a4cfe3dd0d10240
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 7.3.4
2
+ - Use milliseconds timestamp precision in S3 input to fix the skip backup and delete object issue in S3-compatible storage services [#60](https://github.com/logstash-plugins/logstash-integration-aws/pull/60)
3
+
4
+ ## 7.3.3
5
+ - Replace deprecated `Aws::S3::Object#upload_file` in favor of `Aws::S3::TransferManager#upload_file` [#67](https://github.com/logstash-plugins/logstash-integration-aws/pull/67)
6
+
1
7
  ## 7.3.2
2
8
  - Fix: replace deprecated `File.exists?` with `File.exist?` for Ruby 3.4 (JRuby 10) compatibility [#65](https://github.com/logstash-plugins/logstash-integration-aws/pull/65)
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.3.2
1
+ 7.3.4
@@ -148,7 +148,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
148
148
  @logger.debug('Ignoring', :key => log.key)
149
149
  elsif log.content_length <= 0
150
150
  @logger.debug('Object Zero Length', :key => log.key)
151
- elsif log.last_modified <= sincedb_time
151
+ elsif log.last_modified.to_i <= sincedb_time.to_i
152
152
  @logger.debug('Object Not Modified', :key => log.key)
153
153
  elsif log.last_modified > (current_time - @cutoff_second).utc # recently modified files will be processed in next cycle
154
154
  @logger.debug('Object Modified After Cutoff Time', :key => log.key)
@@ -380,7 +380,7 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
380
380
  filename = File.join(temporary_directory, File.basename(log.key))
381
381
  if download_remote_file(object, filename)
382
382
  if process_local_log(queue, filename, object)
383
- if object.last_modified == log.last_modified
383
+ if object.last_modified.to_i == log.last_modified.to_i
384
384
  backup_to_bucket(object)
385
385
  backup_to_dir(filename)
386
386
  delete_file_from_bucket(object)
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/util"
3
- require "aws-sdk-core"
3
+ require "aws-sdk-s3"
4
4
 
5
5
  module LogStash
6
6
  module Outputs
@@ -18,6 +18,7 @@ module LogStash
18
18
 
19
19
  def initialize(bucket, logger, threadpool = DEFAULT_THREADPOOL, retry_count: Float::INFINITY, retry_delay: 1)
20
20
  @bucket = bucket
21
+ @transfer_manager = Aws::S3::TransferManager.new(client: bucket.client)
21
22
  @workers_pool = threadpool
22
23
  @logger = logger
23
24
  @retry_count = retry_count
@@ -37,8 +38,7 @@ module LogStash
37
38
 
38
39
  tries = 0
39
40
  begin
40
- obj = bucket.object(file.key)
41
- obj.upload_file(file.path, upload_options)
41
+ @transfer_manager.upload_file(file.path, bucket: bucket.name, key: file.key, **upload_options)
42
42
  rescue Errno::ENOENT => e
43
43
  logger.error("File doesn't exist! Unrecoverable error.", :exception => e.class, :message => e.message, :path => file.path, :backtrace => e.backtrace)
44
44
  rescue => e
@@ -2,6 +2,7 @@
2
2
  require "stud/temporary"
3
3
  require "socket"
4
4
  require "fileutils"
5
+ require "aws-sdk-s3"
5
6
 
6
7
  module LogStash
7
8
  module Outputs
@@ -39,11 +40,11 @@ module LogStash
39
40
  f.write(content)
40
41
  f.fsync
41
42
 
42
- obj = bucket_resource.object(key)
43
- obj.upload_file(f, upload_options)
43
+ transfer_manager = Aws::S3::TransferManager.new(client: bucket_resource.client)
44
+ transfer_manager.upload_file(f.path, bucket: bucket_resource.name, key: key, **upload_options)
44
45
 
45
46
  begin
46
- obj.delete
47
+ bucket_resource.object(key).delete
47
48
  rescue
48
49
  # Try to remove the files on the remote bucket,
49
50
  # but don't raise any errors if that doesn't work.
@@ -1,4 +1,4 @@
1
1
  # AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.
2
2
 
3
3
  require 'jar_dependencies'
4
- require_jar('org.logstash.plugins.integration.aws', 'logstash-integration-aws', '7.3.2')
4
+ require_jar('org.logstash.plugins.integration.aws', 'logstash-integration-aws', '7.3.4')
@@ -412,28 +412,14 @@ describe LogStash::Inputs::S3 do
412
412
 
413
413
  context "when event doesn't have a `message` field" do
414
414
  let(:log_file) { File.join(File.dirname(__FILE__), '..', 'fixtures', 'json.log') }
415
- let(:config) {
416
- {
417
- "access_key_id" => "1234",
418
- "secret_access_key" => "secret",
419
- "bucket" => "logstash-test",
420
- "codec" => "json",
421
- }
422
- }
415
+ let(:config) { super().merge({ "codec" => "json" }) }
423
416
 
424
417
  include_examples "generated events"
425
418
  end
426
419
 
427
420
  context "when event does have a `message` field" do
428
421
  let(:log_file) { File.join(File.dirname(__FILE__), '..', 'fixtures', 'json_with_message.log') }
429
- let(:config) {
430
- {
431
- "access_key_id" => "1234",
432
- "secret_access_key" => "secret",
433
- "bucket" => "logstash-test",
434
- "codec" => "json",
435
- }
436
- }
422
+ let(:config) { super().merge({ "codec" => "json" }) }
437
423
 
438
424
  include_examples "generated events"
439
425
  end
@@ -476,14 +462,11 @@ describe LogStash::Inputs::S3 do
476
462
 
477
463
  context 'multi-line' do
478
464
  let(:log_file) { File.join(File.dirname(__FILE__), '..', 'fixtures', 'multiline.log') }
479
- let(:config) {
480
- {
481
- "access_key_id" => "1234",
482
- "secret_access_key" => "secret",
483
- "bucket" => "logstash-test",
484
- "codec" => LogStash::Codecs::Multiline.new( {"pattern" => "__SEPARATOR__", "negate" => "true", "what" => "previous"})
485
- }
486
- }
465
+ let(:config) {
466
+ super().merge({
467
+ "codec" => LogStash::Codecs::Multiline.new( {"pattern" => "__SEPARATOR__", "negate" => "true", "what" => "previous"})
468
+ })
469
+ }
487
470
 
488
471
  include_examples "generated events"
489
472
  end
@@ -43,26 +43,22 @@ describe LogStash::Outputs::S3::Uploader do
43
43
  end
44
44
 
45
45
  it "retries errors indefinitely" do
46
- s3 = double("s3").as_null_object
47
-
48
- allow(bucket).to receive(:object).with(file.key).and_return(s3)
46
+ tm = subject.instance_variable_get(:@transfer_manager)
49
47
 
50
48
  expect(logger).to receive(:warn).with(any_args)
51
- expect(s3).to receive(:upload_file).with(any_args).and_raise(RuntimeError.new('UPLOAD FAILED')).exactly(5).times
52
- expect(s3).to receive(:upload_file).with(any_args).and_return(true)
49
+ expect(tm).to receive(:upload_file).with(file.path, hash_including(bucket: bucket_name, key: file.key)).and_raise(RuntimeError.new('UPLOAD FAILED')).exactly(5).times
50
+ expect(tm).to receive(:upload_file).with(file.path, hash_including(bucket: bucket_name, key: file.key)).and_return(true)
53
51
 
54
52
  subject.upload(file)
55
53
  end
56
54
 
57
55
  it "retries errors specified times" do
58
56
  subject = described_class.new(bucket, logger, threadpool, retry_count: 3, retry_delay: 0.01)
59
- s3 = double("s3").as_null_object
60
-
61
- allow(bucket).to receive(:object).with(file.key).and_return(s3)
57
+ tm = subject.instance_variable_get(:@transfer_manager)
62
58
 
63
59
  expect(logger).to receive(:warn).with(any_args).exactly(3).times
64
60
  expect(logger).to receive(:error).with(any_args).once
65
- expect(s3).to receive(:upload_file).with(file.path, {}).and_raise(RuntimeError).at_least(1).times
61
+ expect(tm).to receive(:upload_file).with(file.path, hash_including(bucket: bucket_name, key: file.key)).and_raise(RuntimeError).at_least(1).times
66
62
 
67
63
  subject.upload(file)
68
64
  end
@@ -1,11 +1,13 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/devutils/rspec/spec_helper"
3
+ require "aws-sdk-s3"
3
4
  require "logstash/outputs/s3/write_bucket_permission_validator"
4
5
 
5
6
  describe LogStash::Outputs::S3::WriteBucketPermissionValidator do
6
7
  let(:logger) { spy(:logger ) }
7
8
  let(:bucket_name) { "foobar" }
8
9
  let(:obj) { double("s3_object") }
10
+ let(:tm) { double("transfer_manager") }
9
11
  let(:client) { Aws::S3::Client.new(stub_responses: true) }
10
12
  let(:bucket) { Aws::S3::Bucket.new(bucket_name, :client => client) }
11
13
  let(:upload_options) { {} }
@@ -13,13 +15,14 @@ describe LogStash::Outputs::S3::WriteBucketPermissionValidator do
13
15
  subject { described_class.new(logger) }
14
16
 
15
17
  before do
16
- expect(bucket).to receive(:object).with(any_args).and_return(obj)
18
+ allow(Aws::S3::TransferManager).to receive(:new).with(client: client).and_return(tm)
19
+ allow(bucket).to receive(:object).with(any_args).and_return(obj)
17
20
  end
18
21
 
19
22
  context 'when using upload_options' do
20
23
  let(:upload_options) {{ :server_side_encryption => true }}
21
24
  it 'they are passed through to upload_file' do
22
- expect(obj).to receive(:upload_file).with(anything, upload_options)
25
+ expect(tm).to receive(:upload_file).with(anything, hash_including(upload_options))
23
26
  expect(obj).to receive(:delete).and_return(true)
24
27
  expect(subject.valid?(bucket, upload_options)).to be_truthy
25
28
  end
@@ -28,13 +31,13 @@ describe LogStash::Outputs::S3::WriteBucketPermissionValidator do
28
31
 
29
32
  context "when permissions are sufficient" do
30
33
  it "returns true" do
31
- expect(obj).to receive(:upload_file).with(any_args).and_return(true)
34
+ expect(tm).to receive(:upload_file).with(any_args).and_return(true)
32
35
  expect(obj).to receive(:delete).and_return(true)
33
36
  expect(subject.valid?(bucket, upload_options)).to be_truthy
34
37
  end
35
38
 
36
39
  it "hides delete errors" do
37
- expect(obj).to receive(:upload_file).with(any_args).and_return(true)
40
+ expect(tm).to receive(:upload_file).with(any_args).and_return(true)
38
41
  expect(obj).to receive(:delete).and_raise(StandardError)
39
42
  expect(subject.valid?(bucket, upload_options)).to be_truthy
40
43
  end
@@ -42,7 +45,7 @@ describe LogStash::Outputs::S3::WriteBucketPermissionValidator do
42
45
 
43
46
  context "when permission aren't sufficient" do
44
47
  it "returns false" do
45
- expect(obj).to receive(:upload_file).with(any_args).and_raise(StandardError)
48
+ expect(tm).to receive(:upload_file).with(any_args).and_raise(StandardError)
46
49
  expect(subject.valid?(bucket, upload_options)).to be_falsey
47
50
  end
48
51
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.2
4
+ version: 7.3.4
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-02-11 00:00:00.000000000 Z
10
+ date: 2026-03-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: logstash-core-plugin-api
@@ -407,7 +407,7 @@ files:
407
407
  - spec/spec_helper.rb
408
408
  - spec/support/helpers.rb
409
409
  - spec/unit/outputs/sqs_spec.rb
410
- - vendor/jar-dependencies/org/logstash/plugins/integration/aws/logstash-integration-aws/7.3.2/logstash-integration-aws-7.3.2.jar
410
+ - vendor/jar-dependencies/org/logstash/plugins/integration/aws/logstash-integration-aws/7.3.4/logstash-integration-aws-7.3.4.jar
411
411
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
412
412
  licenses:
413
413
  - Apache-2.0