fluent-plugin-s3-file-inclusion 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 31f5da24c1fd9bd795c66fddf256de81167dc78d0d6ca119bed502193978cc9e
4
+ data.tar.gz: 2c8afde75bced8fd3ccb56653158e9d8e3b9cf6a44d14395bfcb53c36c5773e1
5
+ SHA512:
6
+ metadata.gz: 139dca0af7343d6127587aca351d2b2a1f8bd93b3d47ca72e8e19faa2f7547e573a674687b6b2e40252fa565c33dfc4c903270f2c37752308bdd6c0c8a5c222e
7
+ data.tar.gz: eb406e37d4b605b79b6a934884ee18f93007a0a34675de3194e8da7ff099d57df5ad5b45c2486f6c7d6ef568915bc3dea37b2bef571c558e06cf2fba76ae63bb
@@ -0,0 +1,13 @@
1
+ ~*
2
+ #*
3
+ *~
4
+ [._]*.s[a-w][a-z]
5
+ .DS_Store
6
+
7
+ *.gem
8
+ .bundle
9
+ Gemfile.lock
10
+ vendor
11
+ .ruby-version
12
+
13
+ test/tmp/
@@ -0,0 +1,24 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.4
5
+ - 2.5
6
+ - 2.6
7
+ - 2.7
8
+ - ruby-head
9
+
10
+ gemfile:
11
+ - Gemfile
12
+
13
+ branches:
14
+ only:
15
+ - master
16
+
17
+ before_install: gem update bundler
18
+ script: bundle exec rake test
19
+
20
+ sudo: false
21
+
22
+ matrix:
23
+ allow_failures:
24
+ - rvm: ruby-head
data/AUTHORS ADDED
@@ -0,0 +1,2 @@
1
+ FURUHASHI Sadayuki <frsyuki _at_ gmail.com>
2
+ MASAHIRO Nakagawa <repeatedly _at_ gmail.com>
@@ -0,0 +1,375 @@
1
+ Release 1.4.0 - 2020/08/02
2
+
3
+ * Remove uuidtools dependency
4
+ * in_s3: Add error info to polloing retry log
5
+
6
+ Release 1.3.4 - 2020/07/07
7
+
8
+ * Add sts_http_proxy and sts_endpoint_url to assume_role_credentials
9
+
10
+ Release 1.3.3 - 2020/06/25
11
+
12
+ * Allow fips/gov included endpoint
13
+ * Support sts_region parameter
14
+
15
+ Release 1.3.2 - 2020/05/18
16
+
17
+ * out_s3: Show warning message for object conflict case.
18
+
19
+ Release 1.3.1 - 2020/04/15
20
+
21
+ * out_s3: Support S3 Dual-Stack Endpoints in output plugin via enable_dual_stack parameter
22
+
23
+ Release 1.3.0 - 2020/02/10
24
+
25
+ * in_s3/out_s3: Support AssumeRoleWebIdentityCredentials via `web_identity_credentials` section for EKS.
26
+
27
+ Release 1.2.1 - 2019/11/10
28
+
29
+ * in_s3: Support ECSCredentials
30
+
31
+ Release 1.2.0 - 2019/10/17
32
+
33
+ * out_s3: Add bucket_lifecycle_rule section to set bucket's lifecycle
34
+
35
+ Release 1.1.11 - 2019/06/17
36
+
37
+ * in_s3: Add add_object_metadata parameter
38
+
39
+ Release 1.1.10 - 2019/05/08
40
+
41
+ * out_s3: force_path_style is deprecated
42
+
43
+ Release 1.1.9 - 2019/03/26
44
+
45
+ * out_s3: Add enable_transfer_acceleration parameter
46
+ * Update fluentd dependency to v0.14.22 or later
47
+
48
+ Release 1.1.8 - 2019/01/28
49
+
50
+ * in_s3: Restart SQS polling when the error happens
51
+ * out_s3: Show root cause when error happens during compressor loading
52
+
53
+ Release 1.1.7 - 2018/11/14
54
+
55
+ * in_s3: Fix the bug proxy_uri parameter setting
56
+ * in_s3: Support cross-acount bucket/sqs capability with AssumeRole
57
+
58
+ Release 1.1.6 - 2018/09/11
59
+
60
+ * in_s3: Add s3_endpoint parameter to support S3 compatible service
61
+
62
+ Release 1.1.5 - 2018/09/04
63
+
64
+ * out_s3: Improve check_apikeys performance by specifying `max_keys` parameter
65
+
66
+ Release 1.1.4 - 2018/07/22
67
+
68
+ * out_s3: Support time_slice in `check_object false`. date_slice is kept for backward compatibility
69
+
70
+ Release 1.1.3 - 2018/04/15
71
+
72
+ * in_s3: Fixed extracting gzip's multiple stream.
73
+
74
+ Release 1.1.2 - 2018/04/10
75
+
76
+ * out_s3: Fix memory leak when s3_object_key_format has time related placeholder
77
+
78
+ Release 1.1.1 - 2018/01/10
79
+
80
+ * out_s3: Add index_format parameter
81
+
82
+ Release 1.1.0 - 2017/11/29
83
+
84
+ * Use aws-sdk-s3 / aws-sdk-sqs gems instead of aws-sdk gem
85
+
86
+ Release 1.0.0 - 2017/11/15
87
+
88
+ * Use v0.14 API
89
+ * out_s3: Support canonical user id based grant permission
90
+ * out_s3: Use specified s3_object_key_format even if check_object is false
91
+ * out_s3: Add s3_metadata parameter
92
+ * out_s3: Add ssl_verify_peer parameter
93
+ * in_s3: Unescape S3 key
94
+ * Add use_bundled_cert parameter
95
+
96
+ Release 0.8.0 - 2016/12/20
97
+
98
+ * out_s3: Add check_object / check_bucket parameters for only put permission
99
+ * Remove fluent-mixin-config-placeholders dependency
100
+
101
+
102
+ Release 0.7.2 - 2016/10/20
103
+
104
+ * in_s3: Replace old parser API with new one
105
+ * in_s3: Don't stop SQS polling when error happens
106
+
107
+
108
+ Release 0.7.1 - 2016/09/02
109
+
110
+ * Support IAM role for Amazon ECS task
111
+
112
+
113
+ Release 0.7.0 - 2016/08/10
114
+
115
+ * Add s3 input plugin
116
+
117
+
118
+ Release 0.6.9 - 2016/07/28
119
+
120
+ * Support v0.14
121
+ * Fix aws_iam_retries warning
122
+ * Fix race condition at start with buffers
123
+
124
+
125
+ Release 0.6.8 - 2016/04/19
126
+
127
+ * Add sse customer key options
128
+
129
+
130
+ Release 0.6.7 - 2016/03/31
131
+
132
+ * Add signature_version parameter
133
+ * Add warn_for_delay parameter
134
+
135
+
136
+ Release 0.6.6 - 2016/03/16
137
+
138
+ * Fix ACL handling in PUT operation
139
+
140
+
141
+ Release 0.6.5 - 2016/01/13
142
+
143
+ * Add description to parameters
144
+ * Use path as prefix in API key check
145
+
146
+
147
+ Release 0.6.4 - 2015/12/03
148
+
149
+ * Add secret parameters to role_arn, external_id and ssekms_key_id
150
+ * Fix region handling in assume_role_credentials
151
+
152
+
153
+ Release 0.6.3 - 2015/11/25
154
+
155
+ * Add compute_checksums parameter
156
+
157
+
158
+ Release 0.6.2 - 2015/11/24
159
+
160
+ * Add ssekms_key_id option to use KMS encryption
161
+
162
+
163
+ Release 0.6.1 - 2015/10/30
164
+
165
+ * Fix server_side_encryption error
166
+ * Keep hex random identity on rebooting
167
+ * Fix Tempfile handling on windows
168
+
169
+
170
+ Release 0.6.0 - 2015/10/09
171
+
172
+ * Allow path based calling format
173
+ * Add hex_random placeholder
174
+ * Add overwrite option
175
+
176
+
177
+ Release 0.6.0.pre1 - 2015/09/10
178
+
179
+ * Use AWS SDK v2
180
+
181
+
182
+ Release 0.5.11 - 2015/08/04
183
+
184
+ * Add acl parameter
185
+ * Fix use_server_side_encryption parameter
186
+
187
+
188
+ Release 0.5.10 - 2015/07/27
189
+
190
+ * Add "uuid_flush" placeholder to s3_object_key_format for creating unique object
191
+
192
+
193
+ Release 0.5.9 - 2015/06/10
194
+
195
+ * Add secret option to AWS key related parameters
196
+
197
+
198
+ Release 0.5.8 - 2015/06/09
199
+
200
+ * Fix credential provider selection for env vars
201
+ * Add aws_iam_retries parameter to set number of attemps to the EC2 metadata service
202
+
203
+
204
+ Release 0.5.7 - 2015/03/31
205
+
206
+ * Use s3_endpoint instead of endpoint for S3 Client configuration for S3 compatible services
207
+ * Increase the number of retry when use IAM role
208
+
209
+
210
+ Release 0.5.6 - 2015/03/02
211
+
212
+ * Force to use aws-sdk-v1, not aws-sdk
213
+
214
+
215
+ Release 0.5.5 - 2015/02/19
216
+
217
+ * Revive s3_endpoint parameter for S3 compatible services
218
+
219
+
220
+ Release 0.5.4 - 2015/02/12
221
+
222
+ * Add use_server_side_encryption parameter
223
+
224
+
225
+ Release 0.5.3 - 2015/02/06
226
+
227
+ * Add error information in API check
228
+ * Add GzipWriter fallback to gzip_command
229
+
230
+
231
+ Release 0.5.2 - 2015/02/05
232
+
233
+ * Add experimental gzip_command compressor
234
+
235
+
236
+ Release 0.5.1 - 2014/12/18
237
+
238
+ * Skip apikey_check error when auto_create_bucket is true and bucket doesn't exist
239
+
240
+
241
+ Release 0.5.0 - 2014/12/07
242
+
243
+ * Make compression algorithm pluggable
244
+ * Remove format_json parameter
245
+ * Remove s3_endpoint parameter
246
+ * Relax fluentd version restriction to support 0.12 or later
247
+
248
+
249
+ Release 0.4.3 - 2014/11/10
250
+
251
+ * Change API check message to consider region mismatch
252
+
253
+
254
+ Release 0.4.2 - 2014/10/22
255
+
256
+ * Update fluent-mixin-config-placeholders to v0.3.0
257
+
258
+
259
+ Release 0.4.1 - 2014/10/16
260
+
261
+ * Add 's3_region' option to specify S3 region
262
+ * Restrict aws-sdk gem dependency version to use v1
263
+ * Fix infinite loop when same object path is generated
264
+
265
+
266
+ Release 0.4.0 - 2014/06/06
267
+
268
+ * Add 'format' option to change one line format
269
+ * Update fluentd dependency to v0.10.49
270
+
271
+
272
+ Release 0.3.7 - 2014/03/07
273
+
274
+ * Support lzma2 compression using 'xz' command
275
+ https://github.com/fluent/fluent-plugin-s3/pull/41
276
+ * Relax aws-sdk gem requirement
277
+ https://github.com/fluent/fluent-plugin-s3/pull/42
278
+
279
+
280
+ Release 0.3.6 - 2014/02/05
281
+
282
+ * Support 'log_level' option
283
+
284
+
285
+ Release 0.3.5 - 2013/12/05
286
+
287
+ * Add 'reduced_redundancy' option to store logs in reduced redundancy
288
+ https://github.com/fluent/fluent-plugin-s3/pull/33
289
+
290
+
291
+ Release 0.3.4 - 2013/07/31
292
+
293
+ * Add dynamic path slicing by time formatted string
294
+ https://github.com/fluent/fluent-plugin-s3/pull/24
295
+
296
+
297
+ Release 0.3.3 - 2013/06/18
298
+
299
+ * Fix require bug on case-sensitive environment
300
+
301
+
302
+ Release 0.3.2 - 2013/06/18
303
+
304
+ * Support lzo mime-type
305
+ https://github.com/fluent/fluent-plugin-s3/pull/29
306
+ * Add proxy_uri option
307
+ https://github.com/fluent/fluent-plugin-s3/issues/25
308
+ * Add check_apikey_on_start option
309
+ https://github.com/fluent/fluent-plugin-s3/pull/28
310
+
311
+
312
+ Release 0.3.1 - 2013/03/28
313
+
314
+ * Support json and text mime-types
315
+ https://github.com/fluent/fluent-plugin-s3/pull/20
316
+
317
+
318
+ Release 0.3.0 - 2013/02/19
319
+
320
+ * Enable dynamic and configurable S3 object kyes
321
+ https://github.com/fluent/fluent-plugin-s3/pull/12
322
+ * Fix a lot of temporary files were left on /tmp when the plugin failed to write to S3
323
+ https://github.com/fluent/fluent-plugin-s3/pull/15
324
+ * Enable fluent-mixin-config-placeholders to support hostname, uuid and other parameters in configuration
325
+ https://github.com/fluent/fluent-plugin-s3/pull/19
326
+ * Update 'aws-sdk' version requirement to '~> 1.8.2'
327
+ https://github.com/fluent/fluent-plugin-s3/pull/21
328
+ * Create new S3 bucket if not exists
329
+ https://github.com/fluent/fluent-plugin-s3/pull/22
330
+ * Check the permission and bucket existence at start method, not write method.
331
+
332
+
333
+ Release 0.2.6 - 2013/01/15
334
+
335
+ * Add use_ssl option
336
+
337
+
338
+ Release 0.2.5 - 2012/12/06
339
+
340
+ * Add format_json and time/tag mixin options [#9]
341
+
342
+
343
+ Release 0.2.4 - 2012/11/21
344
+
345
+ * Set content type when writing file to s3
346
+
347
+
348
+ Release 0.2.3 - 2012/11/19
349
+
350
+ * Loosen 'aws-sdk' version requirement from "~> 1.1.3" to "~> 1.1"
351
+ * Support aws-sdk facility to load credentials from ENV vars or IAM Instance Profile by making the credentials non-mandatory
352
+ * Use Yajl instead of to_json not to raise exceptions when it got invalid bytes as UTF-8.
353
+
354
+
355
+ Release 0.2.2 - 2011/12/15
356
+
357
+ * Add s3_endpoint option
358
+
359
+
360
+ Release 0.2.1 - 2011/10/24
361
+
362
+ * Add sequential number to the file to avoid overwriting
363
+ * Use bundler instead of jeweler for packaging
364
+ * Updated README
365
+
366
+
367
+ Release 0.2.0 - 2011/10/16
368
+
369
+ * Updated to fluentd-0.10.0
370
+
371
+
372
+ Release 0.1.1 - 2011/09/27
373
+
374
+ * First release
375
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'json', '= 1.8.3'
4
+ gem 'fluentd', '~> 0.12.0'
5
+
6
+ gemspec
@@ -0,0 +1,845 @@
1
+ # Amazon S3 plugin for [Fluentd](http://github.com/fluent/fluentd)
2
+
3
+ [<img src="https://travis-ci.org/fluent/fluent-plugin-s3.svg?branch=master"
4
+ alt="Build Status" />](https://travis-ci.org/fluent/fluent-plugin-s3) [<img
5
+ src="https://codeclimate.com/github/fluent/fluent-plugin-s3/badges/gpa.svg"
6
+ />](https://codeclimate.com/github/fluent/fluent-plugin-s3)
7
+
8
+ ## Overview
9
+
10
+ **s3** output plugin buffers event logs in local file and upload it to S3
11
+ periodically.
12
+
13
+ This plugin splits files exactly by using the time of event logs (not the time
14
+ when the logs are received). For example, a log '2011-01-02 message B' is
15
+ reached, and then another log '2011-01-03 message B' is reached in this order,
16
+ the former one is stored in "20110102.gz" file, and latter one in
17
+ "20110103.gz" file.
18
+
19
+ **s3** input plugin reads data from S3 periodically. This plugin uses
20
+ SQS queue on the region same as S3 bucket.
21
+ We must setup SQS queue and S3 event notification before use this plugin.
22
+
23
+ ## Requirements
24
+
25
+ | fluent-plugin-s3 | fluentd | ruby |
26
+ |-------------------|---------|------|
27
+ | >= 1.0.0 | >= v0.14.0 | >= 2.1 |
28
+ | < 1.0.0 | >= v0.12.0 | >= 1.9 |
29
+
30
+ ## Installation
31
+
32
+ Simply use RubyGems:
33
+
34
+ # install latest version
35
+ $ gem install fluent-plugin-s3 --no-document # for fluentd v1.0 or later
36
+ # If you need to install specifiv version, use -v option
37
+ $ gem install fluent-plugin-s3 -v 1.3.0 --no-document
38
+ # For v0.12. This is for old v0.12 users. Don't use v0.12 for new deployment
39
+ $ gem install fluent-plugin-s3 -v "~> 0.8" --no-document # for fluentd v0.12
40
+
41
+
42
+ ## Configuration: credentials
43
+
44
+ Both S3 input/output plugin provide several credential methods for authentication/authorization.
45
+
46
+ ### AWS key and secret authentication
47
+
48
+ These parameters are required when your agent is not running on EC2 instance with an IAM Role. When using an IAM role, make sure to configure `instance_profile_credentials`. Usage can be found below.
49
+
50
+ **aws_key_id**
51
+
52
+ AWS access key id.
53
+
54
+ **aws_sec_key**
55
+
56
+ AWS secret key.
57
+
58
+ ### assume_role_credentials
59
+
60
+ Typically, you use AssumeRole for cross-account access or federation.
61
+
62
+ <match *>
63
+ @type s3
64
+
65
+ <assume_role_credentials>
66
+ role_arn ROLE_ARN
67
+ role_session_name ROLE_SESSION_NAME
68
+ </assume_role_credentials>
69
+ </match>
70
+
71
+ See also:
72
+
73
+ * [Using IAM Roles - AWS Identity and Access
74
+ Management](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html)
75
+ * [Aws::STS::Client](http://docs.aws.amazon.com/sdkforruby/api/Aws/STS/Client.html)
76
+ * [Aws::AssumeRoleCredentials](http://docs.aws.amazon.com/sdkforruby/api/Aws/AssumeRoleCredentials.html)
77
+
78
+ **role_arn (required)**
79
+
80
+ The Amazon Resource Name (ARN) of the role to assume.
81
+
82
+ **role_session_name (required)**
83
+
84
+ An identifier for the assumed role session.
85
+
86
+ **policy**
87
+
88
+ An IAM policy in JSON format.
89
+
90
+ **duration_seconds**
91
+
92
+ The duration, in seconds, of the role session. The value can range from
93
+ 900 seconds (15 minutes) to 3600 seconds (1 hour). By default, the value
94
+ is set to 3600 seconds.
95
+
96
+ **external_id**
97
+
98
+ A unique identifier that is used by third parties when assuming roles in
99
+ their customers' accounts.
100
+
101
+ ### web_identity_credentials
102
+
103
+ Similar to the assume_role_credentials, but for usage in EKS.
104
+
105
+ <match *>
106
+ @type s3
107
+
108
+ <web_identity_credentials>
109
+ role_arn ROLE_ARN
110
+ role_session_name ROLE_SESSION_NAME
111
+ web_identity_token_file AWS_WEB_IDENTITY_TOKEN_FILE
112
+ </web_identity_credentials>
113
+ </match>
114
+
115
+ See also:
116
+
117
+ * [Using IAM Roles - AWS Identity and Access
118
+ Management](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html)
119
+ * [IAM Roles For Service Accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html)
120
+ * [Aws::STS::Client](http://docs.aws.amazon.com/sdkforruby/api/Aws/STS/Client.html)
121
+ * [Aws::AssumeRoleWebIdentityCredentials](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/AssumeRoleWebIdentityCredentials.html)
122
+
123
+ **role_arn (required)**
124
+
125
+ The Amazon Resource Name (ARN) of the role to assume.
126
+
127
+ **role_session_name (required)**
128
+
129
+ An identifier for the assumed role session.
130
+
131
+ **web_identity_token_file (required)**
132
+
133
+ The absolute path to the file on disk containing the OIDC token
134
+
135
+ **policy**
136
+
137
+ An IAM policy in JSON format.
138
+
139
+ **duration_seconds**
140
+
141
+ The duration, in seconds, of the role session. The value can range from
142
+ 900 seconds (15 minutes) to 43200 seconds (12 hours). By default, the value
143
+ is set to 3600 seconds.
144
+
145
+
146
+ ### instance_profile_credentials
147
+
148
+ Retrieve temporary security credentials via HTTP request. This is useful on
149
+ EC2 instance.
150
+
151
+ <match *>
152
+ @type s3
153
+
154
+ <instance_profile_credentials>
155
+ ip_address IP_ADDRESS
156
+ port PORT
157
+ </instance_profile_credentials>
158
+ </match>
159
+
160
+ See also:
161
+
162
+ * [Aws::InstanceProfileCredentials](http://docs.aws.amazon.com/sdkforruby/api/Aws/InstanceProfileCredentials.html)
163
+ * [Temporary Security Credentials - AWS Identity and Access
164
+ Management](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html)
165
+ * [Instance Metadata and User Data - Amazon Elastic Compute
166
+ Cloud](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html)
167
+
168
+ **retries**
169
+
170
+ Number of times to retry when retrieving credentials. Default is 5.
171
+
172
+ **ip_address**
173
+
174
+ Default is 169.254.169.254.
175
+
176
+ **port**
177
+
178
+ Default is 80.
179
+
180
+ **http_open_timeout**
181
+
182
+ Default is 5.
183
+
184
+ **http_read_timeout**
185
+
186
+ Default is 5.
187
+
188
+ ### shared_credentials
189
+
190
+ This loads AWS access credentials from local ini file. This is useful for
191
+ local developing.
192
+
193
+ <match *>
194
+ @type s3
195
+
196
+ <shared_credentials>
197
+ path PATH
198
+ profile_name PROFILE_NAME
199
+ </shared_credentials>
200
+ </match>
201
+
202
+ See also:
203
+
204
+ * [Aws::SharedCredentials](http://docs.aws.amazon.com/sdkforruby/api/Aws/SharedCredentials.html)
205
+
206
+ **path**
207
+
208
+ Path to the shared file. Defaults to "#{Dir.home}/.aws/credentials".
209
+
210
+ **profile_name**
211
+
212
+ Defaults to 'default' or `[ENV]('AWS_PROFILE')`.
213
+
214
+ ## Configuration: Output
215
+
216
+ ### v1.0 style
217
+
218
+ With fluentd v1 and fluent-plugin-s3 v1.0.0 or later, use new buffer configuration to dynamic parameters.
219
+
220
+ <match pattern>
221
+ @type s3
222
+
223
+ aws_key_id YOUR_AWS_KEY_ID
224
+ aws_sec_key YOUR_AWS_SECRET_KEY
225
+ s3_bucket YOUR_S3_BUCKET_NAME
226
+ s3_region ap-northeast-1
227
+
228
+ path logs/${tag}/%Y/%m/%d/
229
+ s3_object_key_format %{path}%{time_slice}_%{index}.%{file_extension}
230
+
231
+ # if you want to use ${tag} or %Y/%m/%d/ like syntax in path / s3_object_key_format,
232
+ # need to specify tag for ${tag} and time for %Y/%m/%d in <buffer> argument.
233
+ <buffer tag,time>
234
+ @type file
235
+ path /var/log/fluent/s3
236
+ timekey 3600 # 1 hour partition
237
+ timekey_wait 10m
238
+ timekey_use_utc true # use utc
239
+ </buffer>
240
+ <format>
241
+ @type json
242
+ </format>
243
+ </match>
244
+
245
+ For `<buffer>`, you can use any record field in `path` / `s3_object_key_format`.
246
+
247
+ path logs/${tag}/${foo}
248
+ <buffer tag,foo>
249
+ # parameters...
250
+ </buffer>
251
+
252
+ See official article for more detail: [Config: Buffer Section - Fluentd](https://docs.fluentd.org/configuration/buffer-section)
253
+
254
+ Note that this configuration doesn't work with fluentd v0.12.
255
+
256
+ ### v0.12 style
257
+
258
+ This configuration works with both fluentd v0.12 and v1.0.
259
+
260
+ <match pattern>
261
+ @type s3
262
+
263
+ aws_key_id YOUR_AWS_KEY_ID
264
+ aws_sec_key YOUR_AWS_SECRET_KEY
265
+ s3_bucket YOUR_S3_BUCKET_NAME
266
+ s3_region ap-northeast-1
267
+
268
+ path logs/
269
+ s3_object_key_format %{path}%{time_slice}_%{index}.%{file_extension}
270
+ buffer_path /var/log/fluent/s3
271
+ time_slice_format %Y%m%d-%H
272
+ time_slice_wait 10m
273
+ utc
274
+ format json
275
+ </match>
276
+
277
+ If you want to embed tag in `path` / `s3_object_key_format`, you need to use `fluent-plugin-forest` plugin.
278
+
279
+ **aws_iam_retries**
280
+
281
+ This parameter is deprecated. Use `instance_profile_credentials` instead.
282
+
283
+ The number of attempts to make (with exponential backoff) when loading
284
+ instance profile credentials from the EC2 metadata service using an IAM
285
+ role. Defaults to 5 retries.
286
+
287
+ **s3_bucket (required)**
288
+
289
+ S3 bucket name.
290
+
291
+ **s3_region**
292
+
293
+ s3 region name. For example, US West (Oregon) Region is "us-west-2". The
294
+ full list of regions are available here. >
295
+ http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region. We
296
+ recommend using `s3_region` instead of `s3_endpoint`.
297
+
298
+ **s3_endpoint**
299
+
300
+ endpoint for S3 compatible services. For example, Riak CS based storage or
301
+ something. This option is deprecated for AWS S3, use `s3_region` instead.
302
+
303
+ See also AWS article: [Working with Regions](https://aws.amazon.com/blogs/developer/working-with-regions/).
304
+
305
+ **enable_transfer_acceleration**
306
+
307
+ Enable [S3 Transfer Acceleration](https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html) for uploads. **IMPORTANT**: For this to work, you must first enable this feature on your destination S3 bucket.
308
+
309
+ **enable_dual_stack**
310
+
311
+ Enable [Amazon S3 Dual-Stack Endpoints](https://docs.aws.amazon.com/AmazonS3/latest/dev/dual-stack-endpoints.html) for uploads. Will make it possible to use either IPv4 or IPv6 when connecting to S3.
312
+
313
+ **use_bundled_cert**
314
+
315
+ For cases where the default SSL certificate is unavailable (e.g. Windows), you can set this option to true in order to use the AWS SDK bundled certificate. Default is false.
316
+
317
+ This fixes the following error often seen in Windows:
318
+
319
+ SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Seahorse::Client::NetworkingError)
320
+
321
+ **ssl_verify_peer**
322
+
323
+ Verify SSL certificate of the endpoint. Default is true. Set false when you want to ignore the endpoint SSL certificate.
324
+
325
+ **s3_object_key_format**
326
+
327
+ The format of S3 object keys. You can use several built-in variables:
328
+
329
+ * %{path}
330
+ * %{time_slice}
331
+ * %{index}
332
+ * %{file_extension}
333
+ * %{hex_random}
334
+ * %{uuid_flush}
335
+ * %{hostname}
336
+
337
+ to decide keys dynamically.
338
+
339
+ * %{path} is exactly the value of **path** configured in the configuration file.
340
+ E.g., "logs/" in the example configuration above.
341
+ * %{time_slice} is the
342
+ time-slice in text that are formatted with **time_slice_format**.
343
+ * %{index} is the sequential number starts from 0, increments when multiple files are uploaded to S3 in the same time slice.
344
+ * %{file_extension} depends on **store_as** parameter.
345
+ * %{uuid_flush} a uuid that is replaced everytime the buffer will be flushed.
346
+ * %{hostname} is replaced with `Socket.gethostname` result.
347
+ * %{hex_random} a random hex string that is replaced for each buffer chunk, not
348
+ assured to be unique. This is used to follow a way of performance tuning, `Add
349
+ a Hex Hash Prefix to Key Name`, written in [Request Rate and Performance
350
+ Considerations - Amazon Simple Storage
351
+ Service](https://docs.aws.amazon.com/AmazonS3/latest/dev/request-rate-perf-considerations.html).
352
+ You can configure the length of string with a
353
+ `hex_random_length` parameter (Default: 4).
354
+
355
+ The default format is `%{path}%{time_slice}_%{index}.%{file_extension}`.
356
+ In addition, you can use [buffer placeholders](https://docs.fluentd.org/configuration/buffer-section#placeholders) in this parameter,
357
+ so you can embed tag, time and record value like below:
358
+
359
+ s3_object_key_format %{path}/events/%Y%m%d/${tag}_%{index}.%{file_extension}
360
+ <buffer tag,time>
361
+ # buffer parameters...
362
+ </buffer>
363
+
364
+ For instance, using the example configuration above, actual object keys on S3
365
+ will be something like:
366
+
367
+ "logs/20130111-22_0.gz"
368
+ "logs/20130111-23_0.gz"
369
+ "logs/20130111-23_1.gz"
370
+ "logs/20130112-00_0.gz"
371
+
372
+ With the configuration:
373
+
374
+ s3_object_key_format %{path}/events/ts=%{time_slice}/events_%{index}.%{file_extension}
375
+ path log
376
+ time_slice_format %Y%m%d-%H
377
+
378
+ You get:
379
+
380
+ "log/events/ts=20130111-22/events_0.gz"
381
+ "log/events/ts=20130111-23/events_0.gz"
382
+ "log/events/ts=20130111-23/events_1.gz"
383
+ "log/events/ts=20130112-00/events_0.gz"
384
+
385
+ NOTE: ${hostname} placeholder is deprecated since v0.8. You can get same result by using [configuration's embedded ruby code feature](https://docs.fluentd.org/configuration/config-file#embedded-ruby-code).
386
+
387
+ s3_object_key_format %{path}%{time_slice}_%{hostname}%{index}.%{file_extension}
388
+ s3_object_key_format "%{path}%{time_slice}_#{Socket.gethostname}%{index}.%{file_extension}"
389
+
390
+ Above two configurations are same. The important point is wrapping `""` is needed for `#{Socket.gethostname}`.
391
+
392
+ **force_path_style**
393
+
394
+ :force_path_style (Boolean) — default: false — When set to true, the
395
+ bucket name is always left in the request URI and never moved to the host
396
+ as a sub-domain. See Plugins::S3BucketDns for more details.
397
+
398
+ This parameter is deprecated. See AWS announcement: https://aws.amazon.com/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story/
399
+
400
+ **store_as**
401
+
402
+ archive format on S3. You can use several format:
403
+
404
+ * gzip (default)
405
+ * json
406
+ * text
407
+ * lzo (Need lzop command)
408
+ * lzma2 (Need xz command)
409
+ * gzip_command (Need gzip command)
410
+ * This compressor uses an external gzip command, hence would result in
411
+ utilizing CPU cores well compared with `gzip`
412
+
413
+ See `Use your compression algorithm` section for adding another format.
414
+
415
+ **`<format>` or format**
416
+
417
+ Change one line format in the S3 object. Supported formats are "out_file",
418
+ "json", "ltsv", "single_value" and other formatter plugins. See also [official Formatter article](https://docs.fluentd.org/formatter).
419
+
420
+ * out_file (default).
421
+
422
+ time\ttag\t{..json1..}
423
+ time\ttag\t{..json2..}
424
+ ...
425
+
426
+ * json
427
+
428
+ {..json1..}
429
+ {..json2..}
430
+ ...
431
+
432
+
433
+ At this format, "time" and "tag" are omitted. But you can set these
434
+ information to the record by setting `<inject>` option. If you set following configuration in
435
+ S3 output:
436
+
437
+ # v1
438
+ <format>
439
+ @type json
440
+ </format>
441
+ <inject>
442
+ time_key log_time
443
+ </inject>
444
+ # v0.12
445
+ @format json
446
+ include_time_key true
447
+ time_key log_time # default is time
448
+
449
+ then the record has log_time field.
450
+
451
+ {"log_time":"time string",...}
452
+
453
+ See also [official Inject Section article](https://docs.fluentd.org/configuration/inject-section).
454
+
455
+ * ltsv
456
+
457
+ key1:value1\tkey2:value2
458
+ key1:value1\tkey2:value2
459
+ ...
460
+
461
+ * single_value
462
+
463
+
464
+ Use specified value instead of entire recode. If you get '{"message":"my
465
+ log"}', then contents are
466
+
467
+ my log1
468
+ my log2
469
+ ...
470
+
471
+ You can change key name by "message_key" option.
472
+
473
+ **auto_create_bucket**
474
+
475
+ Create S3 bucket if it does not exists. Default is true.
476
+
477
+ **check_bucket**
478
+
479
+ Check mentioned bucket if it exists in AWS or not. Default is true.
480
+
481
+ When it is false, fluentd will not check aws s3 for the existence of the mentioned bucket.
482
+ This is the case where bucket will be pre-created before running fluentd.
483
+
484
+ **check_object**
485
+
486
+ Check object before creation if it exists or not. Default is true.
487
+
488
+ When it is false, s3_object_key_format will be %{path}%{time_slice}_%{hms_slice}.%{file_extension} by default where,
489
+ hms_slice will be time-slice in hhmmss format, so that each object will be unique.
490
+ Example object name, assuming it is created on 2016/16/11 3:30:54 PM 20161611_153054.txt (extension can be anything as per user's choice)
491
+
492
+ **check_apikey_on_start**
493
+
494
+ Check AWS key on start. Default is true.
495
+
496
+ **proxy_uri**
497
+
498
+ uri of proxy environment.
499
+
500
+ **path**
501
+
502
+ path prefix of the files on S3. Default is "" (no prefix).
503
+ [buffer placeholder](https://docs.fluentd.org/configuration/buffer-section#placeholders) is supported,
504
+ so you can embed tag, time and record value like below.
505
+
506
+ path logs/%Y%m%d/${tag}/
507
+ <buffer tag,time>
508
+ # buffer parameters...
509
+ </buffer>
510
+
511
+ **buffer_path (for v0.12)**
512
+
513
+ path prefix of the files to buffer logs.
514
+
515
+ This parameter is for v0.12. Use `<buffer>`'s `path` in v1.
516
+
517
+ **time_slice_format(for v0.12)**
518
+
519
+ Format of the time used as the file name. Default is '%Y%m%d'. Use
520
+ '%Y%m%d%H' to split files hourly.
521
+
522
+ This parameter is for v0.12. Use buffer placeholder for `path` / `s3_object_key_format` in v1.
523
+
524
+ **time_slice_wait(for v0.12)**
525
+
526
+ The time to wait old logs. Default is 10 minutes. Specify larger value if
527
+ old logs may reach.
528
+
529
+ This parameter is for v0.12. Use `<buffer>`'s `timekey_wait` in v1.
530
+
531
+ **utc**
532
+
533
+ Use UTC instead of local time.
534
+
535
+ **storage_class**
536
+
537
+ Set storage class. Possible values are `STANDARD`, `REDUCED_REDUNDANCY`, `STANDARD_IA` from [Ruby SDK](http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Object.html#storage_class-instance_method).
538
+
539
+ **reduced_redundancy**
540
+
541
+ Use S3 reduced redundancy storage for 33% cheaper pricing. Default is
542
+ false.
543
+
544
+ This is deprecated. Use `storage_class REDUCED_REDUNDANCY` instead.
545
+
546
+ **acl**
547
+
548
+ Permission for the object in S3. This is useful for cross-account access
549
+ using IAM roles. Valid values are:
550
+
551
+ * private (default)
552
+ * public-read
553
+ * public-read-write (not recommended - see [Canned
554
+ ACL](http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl))
555
+ * authenticated-read
556
+ * bucket-owner-read
557
+ * bucket-owner-full-control
558
+
559
+ To use cross-account access, you will need to create a bucket policy granting
560
+ the specific access required. Refer to the [AWS
561
+ documentation](http://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example3.html) for examples.
562
+
563
+ **grant_full_control**
564
+
565
+ Allows grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
566
+ This is useful for cross-account access using IAM roles.
567
+
568
+ Valid values are `id="Grantee-CanonicalUserID"`. Please specify the grantee's canonical user ID.
569
+
570
+ e.g. `id="79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"`
571
+
572
+ Note that a canonical user ID is different from an AWS account ID.
573
+ Please refer to [AWS documentation](https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html) for more details.
574
+
575
+ **grant_read**
576
+
577
+ Allows grantee to read the object data and its metadata.
578
+ Valid values are `id="Grantee-CanonicalUserID"`. Please specify the grantee's canonical user ID.
579
+
580
+ e.g. `id="79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"`
581
+
582
+ **grant_read_acp**
583
+
584
+ Allows grantee to read the object ACL.
585
+ Valid values are `id="Grantee-CanonicalUserID"`. Please specify the grantee's canonical user ID.
586
+
587
+ e.g. `id="79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"`
588
+
589
+ **grant_write_acp**
590
+
591
+ Allows grantee to write the ACL for the applicable object.
592
+ Valid values are `id="Grantee-CanonicalUserID"`. Please specify the grantee's canonical user ID.
593
+
594
+ e.g. `id="79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"`
595
+
596
+ **hex_random_length**
597
+
598
+ The length of `%{hex_random}` placeholder. Default is 4 as written in
599
+ [Request Rate and Performance Considerations - Amazon Simple Storage
600
+ Service](https://docs.aws.amazon.com/AmazonS3/latest/dev/request-rate-perf-considerations.html).
601
+ The maximum length is 16.
602
+
603
+ **index_format**
604
+
605
+ `%{index}` is formatted by [sprintf](http://ruby-doc.org/core-2.2.0/Kernel.html#method-i-sprintf) using this format_string. Default is '%d'. Zero padding is supported e.g. `%04d` to ensure minimum length four digits. `%{index}` can be in lowercase or uppercase hex using '%x' or '%X'
606
+
607
+ **overwrite**
608
+
609
+ Overwrite already existing path. Default is false, which raises an error
610
+ if a s3 object of the same path already exists, or increment the
611
+ `%{index}` placeholder until finding an absent path.
612
+
613
+ **use_server_side_encryption**
614
+
615
+ The Server-side encryption algorithm used when storing this object in S3
616
+ (e.g., AES256, aws:kms)
617
+
618
+ **ssekms_key_id**
619
+
620
+ Specifies the AWS KMS key ID to use for object encryption. You have to
621
+ set "aws:kms" to `use_server_side_encryption` to use the KMS encryption.
622
+
623
+ **sse_customer_algorithm**
624
+
625
+ Specifies the algorithm to use to when encrypting the object (e.g., AES256).
626
+
627
+ **sse_customer_key**
628
+
629
+ Specifies the AWS KMS key ID to use for object encryption.
630
+
631
+ **sse_customer_key_md5**
632
+
633
+ Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.
634
+
635
+ **compute_checksums**
636
+
637
+ AWS SDK uses MD5 for API request/response by default. On FIPS enabled environment,
638
+ OpenSSL returns an error because MD5 is disabled. If you want to use
639
+ this plugin on FIPS enabled environment, set `compute_checksums false`.
640
+
641
+ **signature_version**
642
+
643
+ Signature version for API request. `s3` means signature version 2 and
644
+ `v4` means signature version 4. Default is `nil` (Following SDK's default).
645
+ It would be useful when you use S3 compatible storage that accepts only signature version 2.
646
+
647
+ **warn_for_delay**
648
+
649
+ Given a threshold to treat events as delay, output warning logs if delayed events were put into s3.
650
+
651
+ **bucket_lifecycle_rule**
652
+
653
+ Specify one or more lifecycle rules for the bucket
654
+
655
+ <bucket_lifecycle_rule>
656
+ id UNIQUE_ID_FOR_THE_RULE
657
+ prefix OPTIONAL_PREFIX # Objects whose keys begin with this prefix will be affected by the rule. If not specified all objects of the bucket will be affected
658
+ expiration_days NUMBER_OF_DAYS # The number of days before the object will expire
659
+ </bucket_lifecycle_rule>
660
+
661
+ ## Input: Setup
662
+
663
+ 1. Create new [SQS](https://aws.amazon.com/documentation/sqs/) queue (use same region as S3)
664
+ 2. Set proper permission to new queue
665
+ 3. [Configure S3 event notification](http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html)
666
+ 4. Write configuration file such as fluent.conf
667
+ 5. Run fluentd
668
+
669
+ ## Configuration: Input
670
+
671
+ <source>
672
+ @type s3
673
+
674
+ aws_key_id YOUR_AWS_KEY_ID
675
+ aws_sec_key YOUR_AWS_SECRET_KEY
676
+ s3_bucket YOUR_S3_BUCKET_NAME
677
+ s3_region ap-northeast-1
678
+ add_object_metadata true
679
+
680
+ <sqs>
681
+ queue_name YOUR_SQS_QUEUE_NAME
682
+ </sqs>
683
+ </source>
684
+
685
+ **add_object_metadata**
686
+
687
+ Whether or not object metadata should be added to the record. Defaults to `false`. See below for details.
688
+
689
+ **s3_bucket (required)**
690
+
691
+ S3 bucket name.
692
+
693
+ **s3_region**
694
+
695
+ S3 region name. For example, US West (Oregon) Region is
696
+ "us-west-2". The full list of regions are available here. >
697
+ http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region. We
698
+ recommend using `s3_region` instead of `s3_endpoint`.
699
+
700
+ **store_as**
701
+
702
+ archive format on S3. You can use serveral format:
703
+
704
+ * gzip (default)
705
+ * json
706
+ * text
707
+ * lzo (Need lzop command)
708
+ * lzma2 (Need xz command)
709
+ * gzip_command (Need gzip command)
710
+ * This compressor uses an external gzip command, hence would result in utilizing CPU cores well compared with `gzip`
711
+
712
+ See 'Use your compression algorithm' section for adding another format.
713
+
714
+ **format**
715
+
716
+ Parse a line as this format in the S3 object. Supported formats are
717
+ "apache_error", "apache2", "syslog", "json", "tsv", "ltsv", "csv",
718
+ "nginx" and "none".
719
+
720
+ **check_apikey_on_start**
721
+
722
+ Check AWS key on start. Default is true.
723
+
724
+ **proxy_uri**
725
+
726
+ URI of proxy environment.
727
+
728
+ **sqs/queue_name (required)**
729
+
730
+ SQS queue name. Need to create SQS queue on the region same as S3 bucket.
731
+
732
+ **sqs/skip_delete**
733
+
734
+ When true, messages are not deleted after polling block. Default is false.
735
+
736
+ **sqs/wait_time_seconds**
737
+
738
+ The long polling interval. Default is 20.
739
+
740
+ **sqs/retry_error_interval**
741
+
742
+ Interval to retry polling SQS if polling unsuccessful, in seconds. Default is 300.
743
+
744
+ ## Object Metadata Added To Records
745
+
746
+ If the `add_object_metadata` option is set to true, then the name of the bucket
747
+ and the key for a given object will be added to each log record as `s3_bucket`
748
+ and `s3_key`, respectively. This metadata can be used by filter plugins or other
749
+ downstream processors to better identify the source of a given record.
750
+
751
+ ## IAM Policy
752
+
753
+ The following is an example for a IAM policy needed to write to an s3 bucket (matches my-s3bucket/logs, my-s3bucket-test, etc.).
754
+
755
+ {
756
+ "Version": "2012-10-17",
757
+ "Statement": [
758
+ {
759
+ "Effect": "Allow",
760
+ "Action": [
761
+ "s3:ListBucket"
762
+ ],
763
+ "Resource": "arn:aws:s3:::my-s3bucket"
764
+ },
765
+ {
766
+ "Effect": "Allow",
767
+ "Action": [
768
+ "s3:PutObject",
769
+ "s3:GetObject"
770
+ ],
771
+ "Resource": "arn:aws:s3:::my-s3bucket/*"
772
+ }
773
+ ]
774
+ }
775
+
776
+ Note that the bucket must already exist and **auto_create_bucket** has no effect in this case.
777
+
778
+ `s3:GetObject` is needed for object check to avoid object overwritten.
779
+ If you set `check_object false`, `s3:GetObject` is not needed.
780
+
781
+ Refer to the [AWS
782
+ documentation](http://docs.aws.amazon.com/IAM/latest/UserGuide/ExampleIAMPolicies.html) for example policies.
783
+
784
+ Using [IAM
785
+ roles](http://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html)
786
+ with a properly configured IAM policy are preferred over embedding access keys
787
+ on EC2 instances.
788
+
789
+ ### Example when `check_bucket false` and `check_object false`
790
+
791
+ When the mentioned configuration will be made, fluentd will work with the
792
+ minimum IAM poilcy, like:
793
+
794
+
795
+ "Statement": [{
796
+ "Effect": "Allow",
797
+ "Action": "s3:PutObject",
798
+ "Resource": ["*"]
799
+ }]
800
+
801
+
802
+ ## Use your (de)compression algorithm
803
+
804
+ s3 plugin has pluggable compression mechanizm like Fluentd's input / output
805
+ plugin. If you set 'store_as xxx', `out_s3` plugin searches
806
+ `fluent/plugin/s3_compressor_xxx.rb` and `in_s3` plugin searches
807
+ `fluent/plugin/s3_extractor_xxx.rb`. You can define your (de)compression with
808
+ 'S3Output::Compressor'/`S3Input::Extractor` classes. Compressor API is here:
809
+
810
+ module Fluent # Since fluent-plugin-s3 v1.0.0 or later, use Fluent::Plugin instead of Fluent
811
+ class S3Output
812
+ class XXXCompressor < Compressor
813
+ S3Output.register_compressor('xxx', self)
814
+
815
+ # Used to file extension
816
+ def ext
817
+ 'xxx'
818
+ end
819
+
820
+ # Used to file content type
821
+ def content_type
822
+ 'application/x-xxx'
823
+ end
824
+
825
+ # chunk is buffer chunk. tmp is destination file for upload
826
+ def compress(chunk, tmp)
827
+ # call command or something
828
+ end
829
+ end
830
+ end
831
+ end
832
+
833
+ `Extractor` is similar to `Compressor`
834
+ See bundled `Compressor`/`Extractor` classes for more detail.
835
+
836
+ ## Website, license, et. al.
837
+
838
+ | Web site | http://fluentd.org/ |
839
+ |-------------------|-------------------------------------------|
840
+ | Documents | http://docs.fluentd.org/ |
841
+ | Source repository | http://github.com/fluent/fluent-plugin-s3 |
842
+ | Discussion | http://groups.google.com/group/fluentd |
843
+ | Author | Sadayuki Furuhashi |
844
+ | Copyright | (c) 2011 FURUHASHI Sadayuki |
845
+ | License | Apache License, Version 2.0 |