fluent / fluent-plugin-s3

Amazon S3 input and output plugin for Fluentd
https://docs.fluentd.org/output/s3
314 stars 218 forks source link

How to use {intance_id} to path logs s3 #349

Closed ghost closed 4 years ago

ghost commented 4 years ago

Current config is as follows:

  path ec2-logs/
  s3_object_key_format %{path}%{time_slice}_%{index}.%{file_extension}
  time_slice_format %Y%m%d%H%M

Now, I want to use more {instance_id) field in s3_object_key_format:

  path ec2-logs/%{instance_id}/
  s3_object_key_format %{path}%{time_slice}_%{index}.%{file_extension}
  time_slice_format %Y%m%d%H%M

for logs example:

ec2-logs/i-xxxxxxx/202009101200_0.gz

What do I need to do to get the instance_id field?