Logging from ECS Fargate docker container instance

0

I have a .netcore console app running inside a docker container deployed to an ECS repo. I can run this container from my machine after logging into the ECS service using the AWS CLI. I see all the logs from the running app using stdout (Console.WriteLine from the console app). No issues here. This task is supposed to be called by a Lambda function that is a trigger on a SQS queue. The lambda is correctly triggered when a message arrives in the queue. The Lambda successfully calls the container service (I am logging to CloudWatch). However. for the life of my I cannot figure out how to stream the logs from within my app to CloudWatch. I have the task defined correctly with the required logConfiguration in the task definition.

I can provide further details if anyone can help me. Thank you for reading through my problem.

3 Answers
0
Accepted Answer

Well I resolved this issue with support's help. For anyone facing this issue, the fix was pretty simple (isn't it always!?). For anyone else having this issue here is what the resolution was in my case. I created a task definition in ECS using a .json file and specified the logDriver = awslogs. Pretty standard and well documented. In my use case the task and the network configuration from the lambda had to be overriden to pass in different parameters. The subnets that I was specifying in the lambda had themselves had public IP enabled BUT from the lambda I was not specifying that this should be the case, hence the task was being called but was failing. The task needed to specify AssignPublicIp property in the network config and set it to true, for the task to do anything meaningful. Once I made this change, everything worked like a champ.

8bitboy
answered 9 months ago
0

Yes, actually out of frustration I have given it AdministratorAccess. Still no dice

8bitboy
answered 9 months ago
0

Does the ECS Task have the correct IAM Permissions to create/put log groups and streams to cloudwatch?

profile picture
EXPERT
answered 9 months 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.

Guidelines for Answering Questions