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 11source "http://rubygems.org"
22
3- gem 'uuidtools'
4-
53gemspec
Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ E.g., "logs/" in the example configuration above.
342342time-slice in text that are formatted with ** time_slice_format** .
343343* %{index} is the sequential number starts from 0, increments when multiple files are uploaded to S3 in the same time slice.
344344* %{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.
346346* %{hostname} is replaced with ` Socket.gethostname ` result.
347347* %{hex_random} a random hex string that is replaced for each buffer chunk, not
348348assured to be unique. This is used to follow a way of performance tuning, `Add
Original file line number Diff line number Diff line change 55require 'zlib'
66require 'time'
77require 'tempfile'
8+ require 'securerandom'
89
910module Fluent ::Plugin
1011 class S3Output < Output
@@ -384,7 +385,7 @@ def hex_random(chunk)
384385 end
385386
386387 def uuid_random
387- :: UUIDTools :: UUID . random_create . to_s
388+ SecureRandom . uuid
388389 end
389390
390391 # This is stolen from Fluentd
@@ -441,17 +442,6 @@ def process_s3_object_key_format
441442 }
442443
443444 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
455445 @uuid_flush_enabled = true
456446 end
457447
Original file line number Diff line number Diff line change 99require 'zlib'
1010require 'fileutils'
1111require 'timecop'
12- require 'uuidtools'
1312require 'ostruct'
1413
1514include Fluent ::Test ::Helpers
@@ -349,17 +348,11 @@ def test_write_with_custom_s3_object_key_format
349348
350349 def test_write_with_custom_s3_object_key_format_containing_uuid_flush_placeholder
351350
352- begin
353- require 'uuidtools'
354- rescue LoadError
355- pend ( "uuidtools not found. skip this test" )
356- end
357-
358351 # Partial mock the S3Bucket, not to make an actual connection to Amazon S3
359352 setup_mocks ( true )
360353
361354 uuid = "5755e23f-9b54-42d8-8818-2ea38c6f279e"
362- stub ( ::UUIDTools :: UUID ) . random_create { uuid }
355+ stub ( ::SecureRandom ) . uuid { uuid }
363356
364357 s3_local_file_path = "/tmp/s3-test.txt"
365358 s3path = "log/events/ts=20110102-13/events_0-#{ uuid } .gz"
You can’t perform that action at this time.
0 commit comments