docker compose tag for awslogs stream with server hostname

185 views Asked by At

I want to use awslogs driver to push logs from containers running on my ec2 instances. I am trying to find a way to group the log streams with ec2 instance hostname then container name and then id.

logging:
   driver: "awslogs"
   options:
      awslogs-region: "ap-southeast-2"
      awslogs-group: "<log-group-name>"
      tag: "{{.Name}}/{{.ID}}"

Is there a tag variable for that? Or I need to use environment variable in each container service, if so how do I use a variable in that environment something like

environment:
  SERVER: ${ec2-hostname}
0

There are 0 answers