Skip to content

New deployed Services/Tasks do not show logs anymore

0

I have a CDK that I use now for a couple of months. After deploying today a new instance I recognized that no logs are available anymore. Inside the older instances the logs are present. Was there a change in AWS so ECS Task/Service will not show logs anymore?

1 Answer
0

There hasn't been a general change in AWS that would prevent ECS Tasks/Services from showing logs. However, the issue you're experiencing could be due to a few potential reasons:

  1. Log configuration: Ensure that your task definitions have the correct log configuration. The log driver should be set to 'awslogs' for CloudWatch Logs integration. Check if the 'logConfiguration' property in your task definition is correctly set.

  2. Region mismatch: Verify that the log group is in the same region as your ECS cluster. The ECS console can only display logs from CloudWatch Logs groups in the same region as the cluster. If your log group is in a different region, you won't be able to view the logs directly from the ECS console.

  3. IAM permissions: Check if there have been any changes to the IAM roles associated with your tasks. The task execution role needs permissions to write to CloudWatch Logs.

  4. Log group existence: Confirm that the specified log group exists in CloudWatch. If you're using a new log group name, make sure it's being created correctly.

  5. Log stream prefix: For logs to appear in the ECS console's Log pane, you need to specify a stream prefix. This is typically done using the 'awslogs-stream-prefix' option in the log configuration.

  6. CDK changes: Review any recent changes in your CDK code that might have affected the log configuration for your tasks.

To troubleshoot further:

  • Review your task definition to ensure the log configuration is correct.
  • Check CloudWatch Logs directly to see if logs are being written there.
  • Verify IAM permissions for the task execution role.
  • Ensure the log group exists and is in the correct region.
  • Review your CDK code for any unintended changes to logging configuration.

If you've verified all these points and are still experiencing issues, you may want to reach out to AWS support for further assistance.
Sources
interface LogConfigurationProperty · AWS CDK
ECS Container logs cannot be displayed if the log group is in a different region | AWS re:Post

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.