File tree Expand file tree Collapse file tree 4 files changed +4
-23
lines changed Expand file tree Collapse file tree 4 files changed +4
-23
lines changed Original file line number Diff line number Diff line change 1
1
source "http://rubygems.org"
2
2
3
- gem 'uuidtools'
4
-
5
3
gemspec
Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ E.g., "logs/" in the example configuration above.
342
342
time-slice in text that are formatted with ** time_slice_format** .
343
343
* %{index} is the sequential number starts from 0, increments when multiple files are uploaded to S3 in the same time slice.
344
344
* %{file_extension} depends on ** store_as** parameter.
345
- * %{uuid_flush} a uuid that is replaced everytime the buffer will be flushed. If you want to use this placeholder, install ` uuidtools ` gem first.
345
+ * %{uuid_flush} a uuid that is replaced everytime the buffer will be flushed.
346
346
* %{hostname} is replaced with ` Socket.gethostname ` result.
347
347
* %{hex_random} a random hex string that is replaced for each buffer chunk, not
348
348
assured to be unique. This is used to follow a way of performance tuning, `Add
Original file line number Diff line number Diff line change 5
5
require 'zlib'
6
6
require 'time'
7
7
require 'tempfile'
8
+ require 'securerandom'
8
9
9
10
module Fluent ::Plugin
10
11
class S3Output < Output
@@ -384,7 +385,7 @@ def hex_random(chunk)
384
385
end
385
386
386
387
def uuid_random
387
- :: UUIDTools :: UUID . random_create . to_s
388
+ SecureRandom . uuid
388
389
end
389
390
390
391
# This is stolen from Fluentd
@@ -441,17 +442,6 @@ def process_s3_object_key_format
441
442
}
442
443
443
444
if @s3_object_key_format . include? ( '%{uuid_flush}' )
444
- # test uuidtools works or not
445
- begin
446
- require 'uuidtools'
447
- rescue LoadError
448
- raise Fluent ::ConfigError , "uuidtools gem not found. Install uuidtools gem first"
449
- end
450
- begin
451
- uuid_random
452
- rescue => e
453
- raise Fluent ::ConfigError , "Generating uuid doesn't work. Can't use %{uuid_flush} on this environment. #{ e } "
454
- end
455
445
@uuid_flush_enabled = true
456
446
end
457
447
Original file line number Diff line number Diff line change 9
9
require 'zlib'
10
10
require 'fileutils'
11
11
require 'timecop'
12
- require 'uuidtools'
13
12
require 'ostruct'
14
13
15
14
include Fluent ::Test ::Helpers
@@ -349,17 +348,11 @@ def test_write_with_custom_s3_object_key_format
349
348
350
349
def test_write_with_custom_s3_object_key_format_containing_uuid_flush_placeholder
351
350
352
- begin
353
- require 'uuidtools'
354
- rescue LoadError
355
- pend ( "uuidtools not found. skip this test" )
356
- end
357
-
358
351
# Partial mock the S3Bucket, not to make an actual connection to Amazon S3
359
352
setup_mocks ( true )
360
353
361
354
uuid = "5755e23f-9b54-42d8-8818-2ea38c6f279e"
362
- stub ( ::UUIDTools :: UUID ) . random_create { uuid }
355
+ stub ( ::SecureRandom ) . uuid { uuid }
363
356
364
357
s3_local_file_path = "/tmp/s3-test.txt"
365
358
s3path = "log/events/ts=20110102-13/events_0-#{ uuid } .gz"
You can’t perform that action at this time.
0 commit comments