fluent-plugin-s3 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/ChangeLog +8 -0
- data/README.rdoc +9 -5
- data/VERSION +1 -1
- data/fluent-plugin-s3.gemspec +1 -1
- data/lib/fluent/plugin/out_s3.rb +32 -13
- data/test/out_s3.rb +9 -11
- metadata +33 -13
- checksums.yaml +0 -7
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
Release 0.3.7 - 2014/03/07
|
2
|
+
|
3
|
+
* Support lzma2 compression using 'xz' command
|
4
|
+
https://github.com/fluent/fluent-plugin-s3/pull/41
|
5
|
+
* Relax aws-sdk gem requirement
|
6
|
+
https://github.com/fluent/fluent-plugin-s3/pull/42
|
7
|
+
|
8
|
+
|
1
9
|
Release 0.3.6 - 2014/02/05
|
2
10
|
|
3
11
|
* Support 'log_level' option
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Amazon S3 output plugin for
|
1
|
+
= Amazon S3 output plugin for {Fluentd}[http://github.com/fluent/fluentd]
|
2
2
|
|
3
3
|
== Overview
|
4
4
|
|
@@ -103,8 +103,12 @@ The {fluent-mixin-config-placeholders}[https://github.com/tagomoris/fluent-mixin
|
|
103
103
|
[utc] Use UTC instead of local time.
|
104
104
|
|
105
105
|
|
106
|
-
==
|
107
|
-
|
108
|
-
Copyright:: Copyright (c) 2011 Sadayuki Furuhashi
|
109
|
-
License:: Apache License, Version 2.0
|
106
|
+
== Website, license, et. al.
|
110
107
|
|
108
|
+
Web site:: http://fluentd.org/
|
109
|
+
Documents:: http://docs.fluentd.org/
|
110
|
+
Source repository:: http://github.com/fluent
|
111
|
+
Discussion:: http://groups.google.com/group/fluentd
|
112
|
+
Author:: Sadayuki Furuhashi
|
113
|
+
Copyright:: (c) 2011 FURUHASHI Sadayuki
|
114
|
+
License:: Apache License, Version 2.0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.7
|
data/fluent-plugin-s3.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
|
19
19
|
gem.add_dependency "fluentd", "~> 0.10.0"
|
20
|
-
gem.add_dependency "aws-sdk", "
|
20
|
+
gem.add_dependency "aws-sdk", ">= 1.8.2"
|
21
21
|
gem.add_dependency "yajl-ruby", "~> 1.0"
|
22
22
|
gem.add_dependency "fluent-mixin-config-placeholders", "~> 0.2.0"
|
23
23
|
gem.add_development_dependency "rake", ">= 0.9.2"
|
data/lib/fluent/plugin/out_s3.rb
CHANGED
@@ -35,6 +35,7 @@ class S3Output < Fluent::TimeSlicedOutput
|
|
35
35
|
config_param :s3_endpoint, :string, :default => nil
|
36
36
|
config_param :s3_object_key_format, :string, :default => "%{path}%{time_slice}_%{index}.%{file_extension}"
|
37
37
|
config_param :store_as, :string, :default => "gzip"
|
38
|
+
config_param :command_parameter, :string, :default => nil
|
38
39
|
config_param :auto_create_bucket, :bool, :default => true
|
39
40
|
config_param :check_apikey_on_start, :bool, :default => true
|
40
41
|
config_param :proxy_uri, :string, :default => nil
|
@@ -69,17 +70,21 @@ class S3Output < Fluent::TimeSlicedOutput
|
|
69
70
|
end
|
70
71
|
|
71
72
|
@ext, @mime_type = case @store_as
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
73
|
+
when 'gzip'
|
74
|
+
['gz', 'application/x-gzip']
|
75
|
+
when 'lzo'
|
76
|
+
check_command('lzop', 'LZO')
|
77
|
+
@command_parameter = '-qf1' if @command_parameter.nil?
|
78
|
+
['lzo', 'application/x-lzop']
|
79
|
+
when 'lzma2'
|
80
|
+
check_command('xz', 'LZMA2')
|
81
|
+
@command_parameter = '-qf0' if @command_parameter.nil?
|
82
|
+
['xz', 'application/x-xz']
|
83
|
+
when 'json'
|
84
|
+
['json', 'application/json']
|
85
|
+
else
|
86
|
+
['txt', 'text/plain']
|
87
|
+
end
|
83
88
|
|
84
89
|
@timef = TimeFormatter.new(@time_format, @localtime)
|
85
90
|
|
@@ -109,8 +114,8 @@ class S3Output < Fluent::TimeSlicedOutput
|
|
109
114
|
@s3 = AWS::S3.new(options)
|
110
115
|
@bucket = @s3.buckets[@s3_bucket]
|
111
116
|
|
112
|
-
ensure_bucket
|
113
117
|
check_apikeys if @check_apikey_on_start
|
118
|
+
ensure_bucket
|
114
119
|
end
|
115
120
|
|
116
121
|
def format(tag, time, record)
|
@@ -162,7 +167,13 @@ class S3Output < Fluent::TimeSlicedOutput
|
|
162
167
|
w.close
|
163
168
|
tmp.close
|
164
169
|
# We don't check the return code because we can't recover lzop failure.
|
165
|
-
system "lzop
|
170
|
+
system "lzop #{@command_parameter} -o #{tmp.path} #{w.path}"
|
171
|
+
elsif @store_as == "lzma2"
|
172
|
+
w = Tempfile.new("chunk-xz-tmp")
|
173
|
+
chunk.write_to(w)
|
174
|
+
w.close
|
175
|
+
tmp.close
|
176
|
+
system "xz #{@command_parameter} -c #{w.path} > #{tmp.path}"
|
166
177
|
else
|
167
178
|
chunk.write_to(tmp)
|
168
179
|
tmp.close
|
@@ -194,6 +205,14 @@ class S3Output < Fluent::TimeSlicedOutput
|
|
194
205
|
rescue
|
195
206
|
raise "aws_key_id or aws_sec_key is invalid. Please check your configuration"
|
196
207
|
end
|
208
|
+
|
209
|
+
def check_command(command, algo)
|
210
|
+
begin
|
211
|
+
Open3.capture3("#{command} -V")
|
212
|
+
rescue Errno::ENOENT
|
213
|
+
raise ConfigError, "'#{command}' utility must be in PATH for #{algo} compression"
|
214
|
+
end
|
215
|
+
end
|
197
216
|
end
|
198
217
|
|
199
218
|
|
data/test/out_s3.rb
CHANGED
@@ -27,6 +27,9 @@ class S3OutputTest < Test::Unit::TestCase
|
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
+
def ensure_bucket
|
31
|
+
end
|
32
|
+
|
30
33
|
def check_apikeys
|
31
34
|
end
|
32
35
|
end.configure(conf)
|
@@ -214,8 +217,7 @@ class S3OutputTest < Test::Unit::TestCase
|
|
214
217
|
def test_write_with_custom_s3_object_key_format
|
215
218
|
# Assert content of event logs which are being sent to S3
|
216
219
|
s3obj = flexmock(AWS::S3::S3Object)
|
217
|
-
s3obj.should_receive(:exists?).with_any_args.
|
218
|
-
and_return { false }
|
220
|
+
s3obj.should_receive(:exists?).with_any_args.and_return { false }
|
219
221
|
s3obj.should_receive(:write).with(
|
220
222
|
on { |pathname|
|
221
223
|
data = nil
|
@@ -226,7 +228,7 @@ class S3OutputTest < Test::Unit::TestCase
|
|
226
228
|
gz.close
|
227
229
|
}
|
228
230
|
assert_equal %[2011-01-02T13:14:15Z\ttest\t{"a":1}\n] +
|
229
|
-
|
231
|
+
%[2011-01-02T13:14:15Z\ttest\t{"a":2}\n],
|
230
232
|
data
|
231
233
|
|
232
234
|
pathname.to_s.match(%r|s3-|)
|
@@ -244,12 +246,8 @@ class S3OutputTest < Test::Unit::TestCase
|
|
244
246
|
}
|
245
247
|
|
246
248
|
# Partial mock the S3Bucket, not to make an actual connection to Amazon S3
|
247
|
-
|
248
|
-
|
249
|
-
and_return {
|
250
|
-
s3obj_col
|
251
|
-
}
|
252
|
-
end
|
249
|
+
s3bucket, _ = setup_mocks(true)
|
250
|
+
s3bucket.should_receive(:objects).with_any_args.and_return { s3obj_col }
|
253
251
|
|
254
252
|
# We must use TimeSlicedOutputTestDriver instead of BufferedOutputTestDriver,
|
255
253
|
# to make assertions on chunks' keys
|
@@ -263,9 +261,9 @@ class S3OutputTest < Test::Unit::TestCase
|
|
263
261
|
d.run
|
264
262
|
end
|
265
263
|
|
266
|
-
def setup_mocks
|
264
|
+
def setup_mocks(exists_return = false)
|
267
265
|
s3bucket = flexmock(AWS::S3::Bucket)
|
268
|
-
s3bucket.should_receive(:exists?).with_any_args.and_return {
|
266
|
+
s3bucket.should_receive(:exists?).with_any_args.and_return { exists_return }
|
269
267
|
s3bucket_col = flexmock(AWS::S3::BucketCollection)
|
270
268
|
s3bucket_col.should_receive(:[]).with_any_args.and_return { s3bucket }
|
271
269
|
flexmock(AWS::S3).new_instances do |bucket|
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Sadayuki Furuhashi
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: fluentd
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,20 +30,23 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: aws-sdk
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: 1.8.2
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- -
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: 1.8.2
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: yajl-ruby
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: fluent-mixin-config-placeholders
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,29 +78,33 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rake
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- - '>='
|
83
|
+
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
75
85
|
version: 0.9.2
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
|
-
- - '>='
|
91
|
+
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
82
93
|
version: 0.9.2
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: flexmock
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
|
-
- - '>='
|
99
|
+
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: 1.2.0
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
|
-
- - '>='
|
107
|
+
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
96
109
|
version: 1.2.0
|
97
110
|
description: Amazon S3 output plugin for Fluentd event collector
|
@@ -113,26 +126,33 @@ files:
|
|
113
126
|
- test/out_s3.rb
|
114
127
|
homepage: https://github.com/fluent/fluent-plugin-s3
|
115
128
|
licenses: []
|
116
|
-
metadata: {}
|
117
129
|
post_install_message:
|
118
130
|
rdoc_options: []
|
119
131
|
require_paths:
|
120
132
|
- lib
|
121
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
122
135
|
requirements:
|
123
|
-
- - '>='
|
136
|
+
- - ! '>='
|
124
137
|
- !ruby/object:Gem::Version
|
125
138
|
version: '0'
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
hash: -3014844547885413145
|
126
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
127
144
|
requirements:
|
128
|
-
- - '>='
|
145
|
+
- - ! '>='
|
129
146
|
- !ruby/object:Gem::Version
|
130
147
|
version: '0'
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
hash: -3014844547885413145
|
131
151
|
requirements: []
|
132
152
|
rubyforge_project:
|
133
|
-
rubygems_version:
|
153
|
+
rubygems_version: 1.8.23
|
134
154
|
signing_key:
|
135
|
-
specification_version:
|
155
|
+
specification_version: 3
|
136
156
|
summary: Amazon S3 output plugin for Fluentd event collector
|
137
157
|
test_files:
|
138
158
|
- test/out_s3.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 7f3399bf6de1662008eb3172d029a449f367a8f9
|
4
|
-
data.tar.gz: 533c1fdc074a07ae577463bc342fd537f25919e1
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 1e4e4cf633290fe4630797453305199cb884a96722cf0bc0cdeb96dde0c9b759aae36fa18453872938c8c2d775047972950356371f400781ab446b418c6e2682
|
7
|
-
data.tar.gz: f8f2128b80bb3fc305f53db40ff30172d5b8fbb21406bdd1c9055c7b7c9e4c3bbac197aee160a499f86079ed6a29e34ff44b3d5300df360a95528c196f11c673
|