Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Latest commit

 

History

History
68 lines (63 loc) · 1.78 KB

s3.md

File metadata and controls

68 lines (63 loc) · 1.78 KB

Plugin s3

Variables

Variable name Default Applied function
pattern -
role_arn -
role_session_name -
instance_profile_ip_address -
instance_profile_port -
aws_key_id -
aws_sec_key -
s3_bucket -
s3_region -
s3_endpoint -
s3_object_key_format %{path}%{time_slice}_%{index}.%{file_extension}
bufferPath /buffers/s3
bufferTimeKey 3600
bufferTimeWait 10m
timekey_use_utc true
format json

Plugin template

<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>