logstash-integration-aws 7.1.5-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 +4 -4
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/logstash/outputs/s3.rb +19 -2
- data/lib/logstash-integration-aws_jars.rb +1 -1
- data/spec/outputs/s3_spec.rb +29 -0
- data/vendor/jar-dependencies/org/logstash/plugins/integration/aws/logstash-integration-aws/{7.1.5/logstash-integration-aws-7.1.5.jar → 7.1.6/logstash-integration-aws-7.1.6.jar} +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 163e3851149d6d1e0be9602a1298359cc355f57177bad417429a5c39840ca768
|
4
|
+
data.tar.gz: deadfc6ba818c8081ad796fc2180e80c189da9842b97e1cace008bb2fab44432
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21eaa2c5146017e907a18f7e1b1f479ecf708fd6a89fc771c1283a85a919545e02c064d5944ea29ee5d52bb562079816e8365a1063e810e22c5c6ab7a4b6a6b0
|
7
|
+
data.tar.gz: b65ae6b87d7340c8494877f4be303b83042a93769d99ade69c9d7bc27eced6bf3286fbfd30812cf299495ae0d920e124dbce27153c15bcac313d375bb69aaf6c
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.1.
|
1
|
+
7.1.6
|
data/lib/logstash/outputs/s3.rb
CHANGED
@@ -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
|
-
|
399
|
-
|
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
|
data/spec/outputs/s3_spec.rb
CHANGED
@@ -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
|
Binary file
|
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
|
+
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-
|
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.
|
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
|