Is there a way to remove prefix from docker-compose log in Elastic Beanstalk?

0

hello.

I'm running a service on AWS Elastic Beanstalk (EB) with a "Docker running on 64bit Amazon Linux 2" platform.

And I am saving logs as "Instance log streaming to CloudWatch Logs" in software configuration.

However, when starting the service with docker-compose.yml, the prefix is ​​automatically added to the front of the service log, and when saved to CloudWatch Logs, the JSON format log is saved as a string.

A workaround is to add the --no-log-prefix option after the docker-compose up command.

https://stackoverflow.com/questions/50360674/how-can-i-remove-prefix-with-service-name-from-logs

docker-compose up --no-log-prefix

https://docs.docker.com/engine/reference/commandline/compose_up/

This option is not supported by docker-compose.yml settings.

However, the docker-compose up command is automatically executed when the Docker platform is launched from inside AWS EB, so it seems that users cannot customize it.

Failure to add the --no-log-prefix option prevents CloudWatch from parsing the JSON logs because AWS EB treats them as strings when saving JSON logs to CloudWatch Logs.

TL;DR

I would like to find a way to add the --no-log-prefix option when running docker-compose up on AWS Elastic Beanstalk's docker platform.

Gyu
asked 2 years ago985 views
1 Answer
1

Thank you for reaching out to us. I understand that you want to us the "--no-log-prefix" option in docker compose to filter out the prefixes generated in your log file. Unfortunately currently there is no easy method of achieving this in Elastic Beanstalk, having said that I have reached out to the internal development team regarding this and would request you to raise a Support case with us for a better deep dive of the issue.

AWS
answered 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.

Guidelines for Answering Questions