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
gefragt vor 2 Jahren997 Aufrufe
1 Antwort
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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen