Search code examples
amazon-web-servicesamazon-ecsamazon-cloudwatchecs-taskdefinition

ECS awslogs Log group not being created for Task


Here's part of my task definition:

"logConfiguration": {
      "logDriver": "awslogs",
      "options": {
        "awslogs-group": "/ecs/main-frontend-production-php",
        "awslogs-region": "us-west-1",
        "awslogs-stream-prefix": "ecs",
        "awslogs-create-group": "true"
      }
    },

If I go view the task in the aws console it says the log driver is awslogs and to "View logs in cloudwatch" as soon as I click that I get an error: There was an error getting log events. The specified log group does not exist. and there are no logs.

Kind of at a loss, it seems like from this: https://docs.aws.amazon.com/AmazonECS/latest/userguide/using_awslogs.html that I'm doing it right?

Right now my tasks are stuck in "PENDING" and I have no logs to go off of to find out why.


Solution

  • Ok I finally figured this one out. The reason I had no cloud watch logs was because the image was not getting pulled from ECR. I was always under the impression that "latest" was some magical docker tag. Apparently it's not and I have to actually tag it latest for it to find it.

    I think the cloudwatch logs would have been working all along, but the image couldn't get pulled, so there were no logs to speak of.