lib/fluent/plugin/out_s3.rb in fluent-plugin-s3-0.8.0 vs lib/fluent/plugin/out_s3.rb in fluent-plugin-s3-0.8.1
- old
+ new
@@ -75,10 +75,12 @@
config_param :s3_bucket, :string
desc "S3 region name"
config_param :s3_region, :string, :default => ENV["AWS_REGION"] || "us-east-1"
desc "Use 's3_region' instead"
config_param :s3_endpoint, :string, :default => nil
+ desc "If false, the certificate of endpoint will not be verified"
+ config_param :ssl_verify_peer, :bool, :default => true
desc "The format of S3 object keys"
config_param :s3_object_key_format, :string, :default => "%{path}%{time_slice}_%{index}.%{file_extension}"
desc "If true, the bucket name is always left in the request URI and never moved to the host as a sub-domain"
config_param :force_path_style, :bool, :default => false
desc "Archive format on S3"
@@ -159,11 +161,12 @@
if @reduced_redundancy
$log.warn "reduced_redundancy parameter is deprecated. Use storage_class parameter instead"
@storage_class = "REDUCED_REDUNDANCY"
end
- @s3_object_key_format = process_s3_object_key_format
+ @path = process_deprecated_placeholders(@path)
+ @s3_object_key_format = process_deprecated_placeholders(@s3_object_key_format)
@values_for_s3_object_chunk = {}
end
def start
options = setup_credentials
@@ -171,10 +174,11 @@
options[:endpoint] = @s3_endpoint if @s3_endpoint
options[:http_proxy] = @proxy_uri if @proxy_uri
options[:force_path_style] = @force_path_style
options[:compute_checksums] = @compute_checksums unless @compute_checksums.nil?
options[:signature_version] = @signature_version unless @signature_version.nil?
+ options[:ssl_verify_peer] = @ssl_verify_peer
s3_client = Aws::S3::Client.new(options)
@s3 = Aws::S3::Resource.new(:client => s3_client)
@bucket = @s3.bucket(@s3_bucket)
@@ -303,18 +307,18 @@
raise "The specified bucket does not exist: bucket = #{@s3_bucket}"
end
end
end
- def process_s3_object_key_format
+ def process_deprecated_placeholders(target_path)
%W(%{uuid} %{uuid:random} %{uuid:hostname} %{uuid:timestamp}).each { |ph|
- if @s3_object_key_format.include?(ph)
- raise ConfigError, %!#{ph} placeholder in s3_object_key_format is removed!
+ if target_path.include?(ph)
+ raise ConfigError, %!#{ph} placeholder is removed!
end
}
- if @s3_object_key_format.include?('%{uuid_flush}')
+ if target_path.include?('%{uuid_flush}')
# test uuidtools works or not
begin
require 'uuidtools'
rescue LoadError
raise ConfigError, "uuidtools gem not found. Install uuidtools gem first"
@@ -325,10 +329,10 @@
raise ConfigError, "Generating uuid doesn't work. Can't use %{uuid_flush} on this environment. #{e}"
end
@uuid_flush_enabled = true
end
- @s3_object_key_format.gsub('%{hostname}') { |expr|
+ target_path.gsub('%{hostname}') { |expr|
log.warn "%{hostname} will be removed in the future. Use \"\#{Socket.gethostname}\" instead"
Socket.gethostname
}
end