diff --git a/docs/output.md b/docs/output.md index 2847e8a..7a2d99d 100644 --- a/docs/output.md +++ b/docs/output.md @@ -430,6 +430,18 @@ Specifies the AWS KMS key ID to use for object encryption. Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. +## checksum_algorithm + +AWS allows to calculate the integrity checksum server side. The additional checksum is +used to validate the data during upload or download. The following 4 SHA and CRC algorithms are supported: + +* CRC32 +* CRC32C +* SHA1 +* SHA256 + +For more info refer to [object integrity](https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html). + ## compute_checksums AWS SDK uses MD5 for API request/response by default. On FIPS enabled environment, diff --git a/lib/fluent/plugin/out_s3.rb b/lib/fluent/plugin/out_s3.rb index dc63f07..7ba1abc 100644 --- a/lib/fluent/plugin/out_s3.rb +++ b/lib/fluent/plugin/out_s3.rb @@ -154,6 +154,8 @@ def initialize desc "Arbitrary S3 tag-set for the object" config_param :tagging, :string, default: nil desc "Arbitrary S3 metadata headers to set for the object" + config_param :checksum_algorithm, :string, default: nil + desc "Indicates the algorithm you want Amazon S3 to use to create the checksum for the object (CRC32,CRC32C,SHA1,SHA256)" config_param :s3_metadata, :hash, default: nil config_section :bucket_lifecycle_rule, param_name: :bucket_lifecycle_rules, multi: true do desc "A unique ID for this rule" @@ -368,6 +370,7 @@ def write(chunk) put_options[:grant_read] = @grant_read if @grant_read put_options[:grant_read_acp] = @grant_read_acp if @grant_read_acp put_options[:grant_write_acp] = @grant_write_acp if @grant_write_acp + put_options[:checksum_algorithm] = @checksum_algorithm if @checksum_algorithm put_options[:tagging] = @tagging if @tagging if @s3_metadata