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
已提問 2 年前檢視次數 997 次
1 個回答
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
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南