<match {{ .pattern }}.** >
@type s3
{{- if .role_arn }}
<assume_role_credentials>
role_arn {{ .role_arn }}
role_session_name {{ .role_session_name }}
</assume_role_credentials>
{{- end }}
{{- if .instance_profile_ip_address }}
<instance_profile_credentials>
ip_address {{ .instance_profile_ip_address }}
port {{ .instance_profile_port }}
</instance_profile_credentials>
{{- end }}
{{- if .aws_key_id }}
aws_key_id {{ .aws_key_id }}
aws_sec_key {{ .aws_sec_key }}
{{- end }}
s3_bucket {{ .s3_bucket }}
s3_region {{ .s3_region }}
{{- if .s3_endpoint }}
s3_endpoint {{ .s3_endpoint }}
force_path_style true # This prevents AWS SDK from breaking endpoint URL
{{- end }}
store_as gzip_command
path logs/${tag}/%Y/%m/%d/
s3_object_key_format {{ .s3_object_key_format }}
# if you want to use ${tag} or %Y/%m/%d/ like syntax in path / s3_object_key_format,
# need to specify tag for ${tag} and time for %Y/%m/%d in <buffer> argument.
<buffer tag,time>
@type file
path {{ .bufferPath }}
timekey {{ .bufferTimeKey }}
timekey_wait {{ .bufferTimeWait }}
timekey_use_utc {{ .timekey_use_utc }}
</buffer>
<format>
@type {{ .format }}
</format>
</match>