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

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

format single_value not processed #222

Open MattiDeGrauwe opened 3 years ago

MattiDeGrauwe commented 3 years ago

Problem

When pushing my JSON parsed log to Cloudwatch using the single_value formatter, the log file still arrives at Cloudwatch in JSON format.

Expected Behavior or What you need to ask

<source>
  @type tail
  ...
  <parse>
    @type json
    time_format %Y-%m-%dT%H:%M:%S.%NZ
  </parse>**
</source>

<match x>
  @type cloudwatch_logs
  ...
  <format>
    @type single_value
    message_key log
    add_newline false
  </format>        
</match>

Log arrives at Cloudwatch with this format:

{
    "log": "| 2021-02-03 12:47:19,501 | xxx |",
    "stream": "stdout"
}

Expected format:

 "| 2021-02-03 12:47:19,501 | xxx |"

Using Fluentd and CloudWatchLogs plugin versions

cosmo0920 commented 3 years ago

fluentd-kubernetes-daemonset still uses fluent-plugin-cloudwatch-logs v0.11.2 on the latest debina-cloudwatch image. I'll send a PR to update cloudwatch-logs plugin on the cloudwatch-logs image.

suryapssv commented 2 years ago

@MattiDeGrauwe Is this issue is fixed? i'm also facing the same issue. Logs are not formatted as single_value in cloudwatch.