aws-samples / amazon-ecs-firelens-examples

Sample logging architectures for FireLens on Amazon ECS and AWS Fargate.
MIT No Attribution
303 stars 100 forks source link

Provide examples of using log key values in confs and task definitions #82

Closed nallenscott closed 2 years ago

nallenscott commented 2 years ago

I'm having trouble finding examples of how to access log keys in conf files or, ideally, within the log configuration options in the task definition. For example, I'd like to set the s3_key_format using the value of a key in a JSON log, like below, where keyspace is a top-level key. Is that possible?

{
  "logConfiguration" : {
    "logDriver" : "awsfirelens",
    "options" : {
      "Name" : "s3",
      "bucket" : "my-bucket",
      "s3_key_format": "/$(keyspace)/dt=%Y-%m-%d-%H/$UUID.gz"
    }
  }
}
nallenscott commented 2 years ago

Closing. Looks like fluent bit doesn't allow templating in the s3 plugin. Will have to rewrite the tag and use the tag parts, instead.