fluent-plugin-s3 0.5.2 → 0.5.3
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 +6 -0
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_s3.rb +11 -7
- data/lib/fluent/plugin/s3_compressor_gzip_command.rb +14 -5
- data/lib/fluent/plugin/s3_compressor_lzma2.rb +1 -1
- data/lib/fluent/plugin/s3_compressor_lzo.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4371b4a30965b7724f988a1c101f84af199dc09
|
4
|
+
data.tar.gz: b01e6df47133d2fc117d020e670b6ecfafef1b74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8abdf2a7ce8ea84e235355a9528eb09a39e01f0ddfbca63ad8d474b22f4003d7530ef9c94ab00342e3169a6afded6a4328dfa51b06a36370810eac72673481c8
|
7
|
+
data.tar.gz: 7f5ae08030d544e093ce716c35970bf2cb7cdbfebcf97947c9a214b95d1b458ace7fc449e5e52f44e7e86938d0f0baf4164aeb731d6b4f7b4153aeffbf497f62
|
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
data/lib/fluent/plugin/out_s3.rb
CHANGED
@@ -44,13 +44,12 @@ module Fluent
|
|
44
44
|
end
|
45
45
|
|
46
46
|
begin
|
47
|
-
@compressor = COMPRESSOR_REGISTRY.lookup(@store_as).new
|
47
|
+
@compressor = COMPRESSOR_REGISTRY.lookup(@store_as).new(:buffer_type => @buffer_type, :log => log)
|
48
48
|
rescue => e
|
49
49
|
$log.warn "#{@store_as} not found. Use 'text' instead"
|
50
50
|
@compressor = TextCompressor.new
|
51
51
|
end
|
52
52
|
@compressor.configure(conf)
|
53
|
-
@compressor.buffer_type = @buffer_type
|
54
53
|
|
55
54
|
# TODO: use Plugin.new_formatter instead of TextFormatter.create
|
56
55
|
conf['format'] = @format
|
@@ -139,19 +138,25 @@ module Fluent
|
|
139
138
|
@bucket.empty?
|
140
139
|
rescue AWS::S3::Errors::NoSuchBucket
|
141
140
|
# ignore NoSuchBucket Error because ensure_bucket checks it.
|
142
|
-
rescue
|
143
|
-
raise "can't call S3 API. Please check your aws_key_id / aws_sec_key or s3_region configuration"
|
141
|
+
rescue => e
|
142
|
+
raise "can't call S3 API. Please check your aws_key_id / aws_sec_key or s3_region configuration. error = #{e.inspect}"
|
144
143
|
end
|
145
144
|
|
146
145
|
class Compressor
|
147
146
|
include Configurable
|
148
147
|
|
148
|
+
def initialize(opts = {})
|
149
|
+
super()
|
150
|
+
@buffer_type = opts[:buffer_type]
|
151
|
+
@log = opts[:log]
|
152
|
+
end
|
153
|
+
|
154
|
+
attr_reader :buffer_type, :log
|
155
|
+
|
149
156
|
def configure(conf)
|
150
157
|
super
|
151
158
|
end
|
152
159
|
|
153
|
-
attr_accessor :buffer_type
|
154
|
-
|
155
160
|
def ext
|
156
161
|
end
|
157
162
|
|
@@ -190,7 +195,6 @@ module Fluent
|
|
190
195
|
w.close
|
191
196
|
ensure
|
192
197
|
w.close rescue nil
|
193
|
-
w.unlink rescue nil
|
194
198
|
end
|
195
199
|
end
|
196
200
|
|
@@ -26,15 +26,24 @@ module Fluent
|
|
26
26
|
w = Tempfile.new("chunk-gzip-tmp")
|
27
27
|
chunk.write_to(w)
|
28
28
|
w.close
|
29
|
-
tmp.close
|
30
29
|
w.path
|
31
30
|
end
|
32
|
-
|
33
|
-
system "gzip #{@command_parameter} -c #{path} > #{tmp.path}"
|
31
|
+
|
32
|
+
res = system "gzip #{@command_parameter} -c #{path} > #{tmp.path}"
|
33
|
+
unless res
|
34
|
+
log.warn "failed to execute gzip command. Fallback to GzipWriter. status = #{$?}"
|
35
|
+
begin
|
36
|
+
tmp.truncate(0)
|
37
|
+
gw = Zlib::GzipWriter.new(tmp)
|
38
|
+
chunk.write_to(gw)
|
39
|
+
gw.close
|
40
|
+
ensure
|
41
|
+
gw.close rescue nil
|
42
|
+
end
|
43
|
+
end
|
34
44
|
ensure
|
35
45
|
unless chunk_is_file
|
36
|
-
w.close rescue nil
|
37
|
-
w.unlink rescue nil
|
46
|
+
w.close(true) rescue nil
|
38
47
|
end
|
39
48
|
end
|
40
49
|
end
|