Skip to content

How to set the cloudwatch log group and cloudwatch log stream based on the log message with the new plugin? #371

Description

@gstokkink

Hi,

We've been using the old Cloudwatch Logs plugin for Fluent for some time, and want to start using the new one. However, we make use of templating to set the log group name and log stream name (as described here):

[OUTPUT]
  name                cloudwatch
  match               *
  region              eu-central-1
  log_group_name      $(log_group_name)
  log_stream_name     $(log_stream_name)
  auto_create_group   true
  log_retention_days  30
  retry_limit         false

The log_group_name and log_stream_name keys are present in the log message, the values are then used to set the log group name and the log stream name. This, however, does not seem to work with the new plugin. I noticed that the new plugin should support it through the 'record accessor' syntax, but the following does not result in the log_group_name and log_stream_name being evaluated correctly:

[OUTPUT]
  name                cloudwatch_logs
  match               *
  region              eu-central-1
  log_group_name      $log_group_name
  log_stream_name     $log_stream_name
  auto_create_group   true
  log_retention_days  30
  retry_limit         false

Am I misunderstanding the record accessor syntax? Or does this only apply to metadata, rather than the log message itself?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions