Cloudwatch Log Stream naming

Hi there,

Using docker-compose a container is launched into rancher. Rancher is told to spawn two containers in a stack.

The problem arises trying to read the logs from these two containers it is not clear where the log lines are coming from container-1 or container-2.

The log driver section of docker-compose looks like:

      driver: awslogs
        awslogs-region: eu-central-1
        awslogs-group:  $LOGGING_CONTEXT-$RANCHER_STACK
        awslogs-create-group: true
        tag: my_Container_Name

Where the tag line defines the log stream name and is currently hard coded. After extensive searching, no solution has presented itself yet this seems like it should be quite common.

The desired goal is to replace ‘my_Container_Name’ with something that resolves to:

  • my_Container_Name-1
  • my_Container_Name-2
  • my_Container_Name-x

Please note that some docker provided properties resolve into terms like:

  • r-container_name-1-<this_ID>
  • r-container_name-2-<that_ID>
  • r-container_name-x-<some_ID>

There’s probably something simple that I’m missing.

Any insight or guidance would be gratefully received, thank you.