fluent-plugins-nursery / fluent-plugin-cloudwatch-logs

CloudWatch Logs Plugin for Fluentd
MIT License
201 stars 141 forks source link

How to add metadata to the IN plugin? Getting only the message #189

Closed nwb-rony closed 4 years ago

nwb-rony commented 4 years ago

Problem

I am collecting logs from multiple groups and streams, I want the metadata to be collected as well

Steps to replicate

<source>
  tag cwlogs
  @type cloudwatch_logs
  region us-east-1
  aws_use_sts true
  aws_sts_role_arn MY_ARN
  log_group_name MY_GROUP_NAME
  state_file /home/fluent/GROUP.in.state
  use_log_stream_name_prefix true 
  format none
  <parse>
    @type none
  </parse>
  fetch_interval 10
</source>

<match cwlogs>
  @type copy
  <store>
    @type file
    path /var/log/fluent/access
    append true
  </store> 
</match>

And I am receiving logs in the following format (in access dir):

2020-05-12T15:37:55+00:00       cwlogs  {"message":"MY MSG"}
2020-05-12T15:37:55+00:00       cwlogs  {"message":"MY MSG"}

Expected Behavior or What you need to ask

I want to have something like this:

2020-05-12T15:37:55+00:00       cwlogs  {"message":"MY MSG", "log_group_name": "MY GROUP", log_stream_name: "MY STREAM", etc....}

Using Fluentd and CloudWatchLogs plugin versions

Thanks a lot!

cosmo0920 commented 4 years ago

I'd registered PR to support this: https://github.com/fluent-plugins-nursery/fluent-plugin-cloudwatch-logs/pull/193

cosmo0920 commented 4 years ago

193 should be merged. Closing.