copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Add ability to select container for logs command

Open Fodoj opened this issue 2 years ago • 4 comments

At the moment, copilot svc logs command only streams logs from the main application container. If there are any sidecars, its now showing those logs. Feature proposal is to do something like copilot svc logs -n web -e preprod -c $sidecarName to show logs of $sidecarName container when needed.

Fodoj avatar Aug 06 '22 15:08 Fodoj

@Fodoj Thank you for your request. This feature makes sense to me.

paragbhingre avatar Aug 08 '22 18:08 paragbhingre

Hello @Fodoj !

From what I see now, copilot svc logs should show the logs from both the main container as well as the sidecars. For example

Found only one deployed service web in environment test
copilot/mysidecar/1111111 This is from a sidecar
copilot/mysidecar/2222222 This is from a sidecar
copilot/web/1111111 2022/08/12 20:20:16 Get Succeeded
copilot/web/2222222 2022/08/12 20:20:16 Get Succeeded

where mysidecars is the sidecar container's name, and web is the service.

Is this consistent with what you are seeing right now?

Lou1415926 avatar Aug 12 '22 20:08 Lou1415926

It does indeed show logs from all containers, which can be a bit noisy if primary container logs a lot, and sidecar logs way less - and I want to see only sidecar logs to investigate some issue there :)

Fodoj avatar Aug 12 '22 20:08 Fodoj

Sounds good! Yes just wanted to clarify 👍🏼. For example, running copilot svc logs -n web -e test --container mysidecar should show the logs from the mysidecar only.

Lou1415926 avatar Aug 12 '22 20:08 Lou1415926

This feature is now released in v1.22 🚀 !

For the blog post: https://aws.github.io/copilot-cli/blogs/release-v122/ Release notes: https://github.com/aws/copilot-cli/releases/tag/v1.22.0

efekarakus avatar Sep 27 '22 17:09 efekarakus