logstash-integration-aws 7.1.4-java → 7.1.6-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: a30619ed8bc31761d0134555c20ba7f9e682cce080d89d36e83cbc1a402d4678
4
- data.tar.gz: f1b9247104f4e1ad28b6bab42696ebf064f9fac37d0cfdcf03a3269bcb25566b
3
+ metadata.gz: 163e3851149d6d1e0be9602a1298359cc355f57177bad417429a5c39840ca768
4
+ data.tar.gz: deadfc6ba818c8081ad796fc2180e80c189da9842b97e1cace008bb2fab44432
5
5
  SHA512:
6
- metadata.gz: b424d54d88b11c1cdc12b5d27e5da5d6c3900331f4dab53d0f6931ddfa4adaf678251103f3ec7f70ae3a52c632ed83138efe153efd122d84ff916e7091e09fa7
7
- data.tar.gz: d585032f64c6f9f3ffcc91653bf06446e157e6c2f4f1370f084ab18967b900e64a36f0df76e4b5325380b19ed795fbe4e91a7039737270a106ad9b57d78d1634
6
+ metadata.gz: 21eaa2c5146017e907a18f7e1b1f479ecf708fd6a89fc771c1283a85a919545e02c064d5944ea29ee5d52bb562079816e8365a1063e810e22c5c6ab7a4b6a6b0
7
+ data.tar.gz: b65ae6b87d7340c8494877f4be303b83042a93769d99ade69c9d7bc27eced6bf3286fbfd30812cf299495ae0d920e124dbce27153c15bcac313d375bb69aaf6c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 7.1.6
2
+ - Clean up plugin created temporary dirs at startup [#39](https://github.com/logstash-plugins/logstash-integration-aws/pull/39)
3
+
4
+ ## 7.1.5
5
+ - Fix external documentation links [#35](https://github.com/logstash-plugins/logstash-integration-aws/pull/35)
6
+
1
7
  ## 7.1.4
2
8
  - Fix `use_aws_bundled_ca` to use bundled ca certs per plugin level instead of global [#33](https://github.com/logstash-plugins/logstash-integration-aws/pull/33)
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.1.4
1
+ 7.1.6
@@ -109,7 +109,7 @@ This plugin uses the AWS SDK and supports several ways to get credentials, which
109
109
  * Default value is `{}`
110
110
 
111
111
  Key-value pairs of settings and corresponding values used to parametrize
112
- the connection to s3. See full list in https://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Client.html[the AWS SDK documentation]. Example:
112
+ the connection to s3. See full list in https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Client.html[the AWS SDK documentation]. Example:
113
113
 
114
114
  [source,ruby]
115
115
  input {
@@ -131,7 +131,7 @@ This plugin uses the AWS SDK and supports several ways to get credentials, which
131
131
  * Default value is `{}`
132
132
 
133
133
  Key-value pairs of settings and corresponding values used to parametrize
134
- the connection to SQS. See full list in https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/SQS/Client.html[the AWS SDK documentation]. Example:
134
+ the connection to SQS. See full list in https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SQS/Client.html[the AWS SDK documentation]. Example:
135
135
 
136
136
  [source,ruby]
137
137
  input {
@@ -143,7 +143,7 @@ This plugin uses the AWS SDK and supports several ways to get credentials, which
143
143
  * Default value is `{}`
144
144
 
145
145
  Key-value pairs of settings and corresponding values used to parametrize
146
- the connection to S3. See full list in https://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Client.html[the AWS SDK documentation]. Example:
146
+ the connection to S3. See full list in https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Client.html[the AWS SDK documentation]. Example:
147
147
 
148
148
  [source,ruby]
149
149
  output {
@@ -395,8 +395,9 @@ class LogStash::Outputs::S3 < LogStash::Outputs::Base
395
395
  @crash_uploader = Uploader.new(bucket_resource, @logger, CRASH_RECOVERY_THREADPOOL)
396
396
 
397
397
  temp_folder_path = Pathname.new(@temporary_directory)
398
- files = Dir.glob(::File.join(@temporary_directory, "**/*"))
399
- .select { |file_path| ::File.file?(file_path) }
398
+ all_files = Dir.glob(::File.join(@temporary_directory, "**/*"))
399
+ removed_dirs = remove_empty_dirs(all_files)
400
+ files = all_files.select { |file_path| !removed_dirs.include?(file_path) && ::File.file?(file_path) }
400
401
  under_recovery_files = get_under_recovery_files(files)
401
402
 
402
403
  files.each do |file_path|
@@ -439,4 +440,20 @@ class LogStash::Outputs::S3 < LogStash::Outputs::Base
439
440
  end
440
441
  skip_files
441
442
  end
443
+
444
+ # Sorts explored files in desc order
445
+ # And proceeds bottom-up traversal remove operation if dir is empty
446
+ # Returns removed set to avoid duplicate Dir.glob process
447
+ def remove_empty_dirs(files)
448
+ removed_dirs = Set.new
449
+ files.sort { |x, y| y.length - x.length } # make sure to remove from leaf node
450
+ .select { |path| ::File.directory?(path) }
451
+ .select { |path| (Dir.entries(path) - %w[ . .. ]).empty? } # current and parent dirs escape
452
+ .each do |path|
453
+ @logger.debug? && @logger.debug("Removing empty temporary file", :path => path)
454
+ FileUtils.rm_f(path)
455
+ removed_dirs << path
456
+ end
457
+ removed_dirs
458
+ end
442
459
  end
@@ -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.1.4')
4
+ require_jar('org.logstash.plugins.integration.aws', 'logstash-integration-aws', '7.1.6')
@@ -229,4 +229,33 @@ describe LogStash::Outputs::S3 do
229
229
  end
230
230
  end
231
231
  end
232
+
233
+ context "remove empty dirs" do
234
+
235
+ before do
236
+ allow(File).to receive(:directory?).with('/path/to/bar-empty').and_return(true)
237
+ allow(File).to receive(:directory?).with('/path/to/foo/empty-dir').and_return(true)
238
+ allow(File).to receive(:directory?).with('/path/to/foo-file').and_return(true)
239
+ allow(File).to receive(:directory?).with('/path/to/foo-file/file.tmp').and_return(false)
240
+ allow(File).to receive(:directory?).with('/path/to/foo').and_return(true)
241
+
242
+ allow(Dir).to receive(:entries).with('/path/to/bar-empty').and_return([])
243
+ allow(Dir).to receive(:entries).with('/path/to/foo/empty-dir').and_return(%w(. ..))
244
+ allow(Dir).to receive(:entries).with('/path/to/foo-file').and_return(%w(/path/to/foo-file/file.tmp))
245
+ allow(Dir).to receive(:entries).with('/path/to/foo').and_return(%w(. .. empty-dir))
246
+ end
247
+
248
+ it "removes empty dirs" do
249
+ # Dir.glob() discovered files
250
+ files = %w(/path/to/bar-empty /path/to/foo/empty-dir /path/to/foo-file/file.tmp /path/to/foo-file)
251
+ removed_dirs = subject.send(:remove_empty_dirs, files)
252
+
253
+ expect(removed_dirs.include?('/path/to/bar-empty')).to be_truthy
254
+ expect(removed_dirs.include?('/path/to/foo/empty-dir')).to be_truthy
255
+ expect(removed_dirs.include?('/path/to/foo-file')).to be_falsey
256
+ expect(removed_dirs.include?('/path/to/foo-file/file.tmp')).to be_falsey
257
+ expect(removed_dirs.include?('/path/to/foo')).to be_falsey
258
+ end
259
+ end
260
+
232
261
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.4
4
+ version: 7.1.6
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-15 00:00:00.000000000 Z
11
+ date: 2023-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -408,7 +408,7 @@ files:
408
408
  - spec/spec_helper.rb
409
409
  - spec/support/helpers.rb
410
410
  - spec/unit/outputs/sqs_spec.rb
411
- - vendor/jar-dependencies/org/logstash/plugins/integration/aws/logstash-integration-aws/7.1.4/logstash-integration-aws-7.1.4.jar
411
+ - vendor/jar-dependencies/org/logstash/plugins/integration/aws/logstash-integration-aws/7.1.6/logstash-integration-aws-7.1.6.jar
412
412
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
413
413
  licenses:
414
414
  - Apache-2.0