logstash-output-s3 4.1.6 → 4.1.7
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/Gemfile +4 -0
- data/lib/logstash/outputs/s3.rb +6 -2
- data/logstash-output-s3.gemspec +1 -1
- data/spec/integration/restore_from_crash_spec.rb +40 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d0273662b68bd9801f7320aa01736ad40539ca29a4d5f895a6245f4cf7b9542
|
4
|
+
data.tar.gz: 676f7a10a587bc64fe4e2229f3ab79e60f807636ce9bcf2c80ecb2b91ff97ded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 010f9bd2d079f32077df912cfc0d333208d8a2f76ba4ee0ac341c0f3b84c94aabe3faa9ca76eca3f9998a50e1c772fbfead9ce9b453caa511901817ca89332e0
|
7
|
+
data.tar.gz: 8cd6b94465ba40e5b771ffaf33abf052fcac3da1ba82614e73cd8fb74292c07b53497b2b607d849fbbf7590225f36f43972e5ad98c9a8d93217c0480d7bc7db2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 4.1.7
|
2
|
+
- Fixed issue where on restart, 0 byte files could erroneously be uploaded to s3 [#195](https://github.com/logstash-plugins/logstash-output-s3/issues/195)
|
3
|
+
|
1
4
|
## 4.1.6
|
2
5
|
- Fixed leak of file handles that prevented temporary files from being cleaned up before pipeline restart [#190](https://github.com/logstash-plugins/logstash-output-s3/issues/190)
|
3
6
|
|
data/Gemfile
CHANGED
@@ -9,3 +9,7 @@ if Dir.exist?(logstash_path) && use_logstash_source
|
|
9
9
|
gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
|
10
10
|
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
|
11
11
|
end
|
12
|
+
|
13
|
+
if RUBY_VERSION == "1.9.3"
|
14
|
+
gem 'rake', '12.2.1'
|
15
|
+
end
|
data/lib/logstash/outputs/s3.rb
CHANGED
@@ -385,8 +385,12 @@ class LogStash::Outputs::S3 < LogStash::Outputs::Base
|
|
385
385
|
.select { |file| ::File.file?(file) }
|
386
386
|
.each do |file|
|
387
387
|
temp_file = TemporaryFile.create_from_existing_file(file, temp_folder_path)
|
388
|
-
|
389
|
-
|
388
|
+
if temp_file.size > 0
|
389
|
+
@logger.debug("Recovering from crash and uploading", :file => temp_file.path)
|
390
|
+
@crash_uploader.upload_async(temp_file, :on_complete => method(:clean_temporary_file), :upload_options => upload_options)
|
391
|
+
else
|
392
|
+
clean_temporary_file(temp_file)
|
393
|
+
end
|
390
394
|
end
|
391
395
|
end
|
392
396
|
end
|
data/logstash-output-s3.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-s3'
|
3
|
-
s.version = '4.1.
|
3
|
+
s.version = '4.1.7'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = "Sends Logstash events to the Amazon Simple Storage Service"
|
6
6
|
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"
|
@@ -11,29 +11,56 @@ describe "Restore from crash", :integration => true do
|
|
11
11
|
|
12
12
|
let(:number_of_files) { 5 }
|
13
13
|
let(:dummy_content) { "foobar\n" * 100 }
|
14
|
+
let(:factory) { LogStash::Outputs::S3::TemporaryFileFactory.new(prefix, tags, "none", temporary_directory)}
|
14
15
|
|
15
16
|
before do
|
16
17
|
clean_remote_files(prefix)
|
17
|
-
|
18
|
-
factory = LogStash::Outputs::S3::TemporaryFileFactory.new(prefix, tags, "none", temporary_directory)
|
18
|
+
end
|
19
19
|
|
20
|
-
# Creating a factory always create a file
|
21
|
-
factory.current.write(dummy_content)
|
22
|
-
factory.current.fsync
|
23
20
|
|
24
|
-
|
25
|
-
|
21
|
+
context 'with a non-empty tempfile' do
|
22
|
+
before do
|
23
|
+
# Creating a factory always create a file
|
26
24
|
factory.current.write(dummy_content)
|
27
25
|
factory.current.fsync
|
26
|
+
|
27
|
+
(number_of_files - 1).times do
|
28
|
+
factory.rotate!
|
29
|
+
factory.current.write(dummy_content)
|
30
|
+
factory.current.fsync
|
31
|
+
end
|
32
|
+
end
|
33
|
+
it "uploads the file to the bucket" do
|
34
|
+
subject.register
|
35
|
+
try(20) do
|
36
|
+
expect(bucket_resource.objects(:prefix => prefix).count).to eq(number_of_files)
|
37
|
+
expect(Dir.glob(File.join(temporary_directory, "*")).size).to eq(0)
|
38
|
+
expect(bucket_resource.objects(:prefix => prefix).first.acl.grants.collect(&:permission)).to include("READ", "WRITE")
|
39
|
+
end
|
28
40
|
end
|
29
41
|
end
|
30
42
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
43
|
+
context 'with an empty tempfile' do
|
44
|
+
before do
|
45
|
+
factory.current
|
46
|
+
factory.rotate!
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should remove the temporary file" do
|
50
|
+
expect(Dir.glob(::File.join(temporary_directory, "**", "*")).size).to be > 0
|
51
|
+
subject.register
|
52
|
+
puts Dir.glob(::File.join(temporary_directory, "**", "*"))
|
53
|
+
expect(Dir.glob(::File.join(temporary_directory, "**", "*")).size).to eq(0)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should not upload the file to the bucket" do
|
57
|
+
expect(bucket_resource.objects(:prefix => prefix).count).to eq(0)
|
58
|
+
expect(Dir.glob(::File.join(temporary_directory, "**", "*")).size).to be > 0
|
59
|
+
subject.register
|
60
|
+
|
61
|
+
# Sleep to give enough time for plugin upload to s3 if it attempts to upload empty temporary file to S3
|
62
|
+
sleep 5
|
63
|
+
expect(bucket_resource.objects(:prefix => prefix).count).to eq(0)
|
37
64
|
end
|
38
65
|
end
|
39
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|