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

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

log_stream_name does not extract its tag placeholder #132

Closed koooge closed 5 years ago

koooge commented 5 years ago

Hi there. CloudwatchLogsOutput#write seems to call to put_events() with non-extracted stream_name (version 0.7.0)

conf

log_group_name "some-group"
log_stream_name "something-${tag[1]}"

output

2018-11-29 06:40:46 +0000 [debug]: #0 Called PutLogEvents API group="some-group" stream="something-${tag[1]}" events_count=1 events_bytesize=48 sequence_token=nil thread=47124812535360 request_sec=0.0963896
cosmo0920 commented 5 years ago

Could you show us your configuration?

cosmo0920 commented 5 years ago

Ah, using w/o buffer configuration, right?

extract_placeholders API uses buffer's metadata. So, you should use the following configuration:

<match a.some.of.your.tag>
  @type cloudwatch_logs
  log_group_name "some-group"
  log_stream_name "something-${tag[1]}"
  <buffer tag> # tag attributes is needed!!!
    @type memory
  </buffer>
</match>
koooge commented 5 years ago

Aha, you are right. Thank you so much!!! 🙇 I feel that it may make someone confusing. So please refer this on docs 🙏

cosmo0920 commented 5 years ago

Hmm, I'll add some note for built-in placeholders. Thank you for quick feedback! It's very helpful for us. :smile_cat: