5

I'm trying to configure logentries for a Task Definition on AWS ECS As you can see here "logentries" is available for container instances.

However I can not find any documentation or example about how to configure it. I've seen examples of other drivers: https://docs.aws.amazon.com/AmazonECS/latest/userguide/example_task_definitions.html

So I've tried to set the needed parameters defined in this documentation in the aws console: enter image description here

However when I try to run a task with this configuration I get:

service my-service was unable to place a task because no container instance met all of its requirements. The closest matching container-instance is missing an attribute required by your task. For more information, see the Troubleshooting section.

Any ideas?

Ignasi
  • 5,887
  • 7
  • 45
  • 81

1 Answers1

2

In the case of splunk logging in ECS (with EC2 instances as hosts with the ECS optimized image, and not Fargate), you had to explicitly boot the instance with splunk logging enabled, by setting ENV variable ECS_AVAILABLE_LOGGING_DRIVERS at boot time (you can use userdata for this). There is a similar option for logentries.

See https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html

Your error message is not about the configuration of logentries being incorrect, rather that logentries is unavailable altogether in the environment.

jishi
  • 24,126
  • 6
  • 49
  • 75
  • I've included: # Write ECS config file cat << EOF > /etc/ecs/ecs.config ECS_AVAILABLE_LOGGING_DRIVERS=["json-file","awslogs","logentries"] EOF Into the user-data of the EC2 (has been launched using an ECS optimized image) and I've got the same results – Ignasi May 04 '20 at 15:16
  • @ilopezluna did you have it the whole time, or did you add it? userData is only invoked on the first boot of the instance, so it's not enough to reboot it. You need to terminate it and launch a new one. How are you launching your EC2 instance? Via an autoscaling group? – jishi May 05 '20 at 08:31
  • I'm launching the EC2 instance using a Cloud Formation script. However on my previous test I tried as you mention, just rebooting. Now I've tried to include the user data in the CloudFormation script itself, and launching again all the stack and it works. So you were right, the only missing thing was to include the ECS_AVAILABLE_LOGGING_DRIVERS in the user data – Ignasi May 05 '20 at 08:40
  • Is there an option where I can specify the file to stream to CloudWatch along with this "ECS_AVAILABLE_LOGGING_DRIVERS" ? – Babar Baig Nov 25 '20 at 10:14
  • @BabarBaig ECS only works with stdout-logging, not files. If you need to forward files to a logging service you need to run that as a separate application somehow and outside of scope for this question. – jishi Nov 25 '20 at 14:52