Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws logs tail --follow never exits #8576

Open
BeyondEvil opened this issue Mar 13, 2024 · 2 comments
Open

aws logs tail --follow never exits #8576

BeyondEvil opened this issue Mar 13, 2024 · 2 comments
Assignees
Labels
bug This issue is a bug. logs p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@BeyondEvil
Copy link

Describe the bug

aws logs tail <log_group> --log-stream-names <stream name> --follow

Never exits even tho no more logs are coming in due to the service (Fargate Task in this case) has exited.

This means I have to quit the command using Ctrl-C and hence can't use it programatically.

Expected Behavior

aws logs tail should time out when no more logs are coming in.

Current Behavior

aws logs tail <log_group> --log-stream-names <stream name> --follow

Never exits even tho no more logs are coming in due to the service (Fargate Task in this case) has exited.

Reproduction Steps

  • Start a Fargate task
  • Run the command
  • Observe command not finish when task is finished

This is reproducibel on both Mac and Linux systems.

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.13.33 Python/3.11.6 Darwin/23.2.0 exe/x86_64 prompt/off

Environment details (OS name and version, etc.)

macOS (M2) Sonoma 14.2.1

@BeyondEvil BeyondEvil added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 13, 2024
@julienfdev
Copy link

i'm sorry but why is it a bug ? the log group still exists, thus, the logs tail --follow does not exits.
an ECS task finishing has absolutely nothing to do with the state of your log group / stream.

If you need to do something programmatically, either trigger an SNS event when the task is finished or monitor its status inside your app

@tim-finnigan tim-finnigan self-assigned this May 15, 2024
@tim-finnigan tim-finnigan added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label May 15, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reaching out and your patience here. The tail command documentation notes the following for the --follow parameter:

--follow (boolean) Whether to continuously poll for new logs. By default, the command will exit once there are no more logs to display. To exit from this mode, use Control-C.

So if there are no more logs then I would expect the command to exit. Is this issue consistently reproducible? And outside of Fargate as well? Have you tried testing on more recent versions of the CLI? (The latest version per the CHANGELOG is 2.15.51.)

There may be a delay in the ingestion of logs from the Fargate task to the CloudWatch Logs service. It's also possible that the log stream associated with the Fargate task is not being properly terminated or marked as complete, causing the aws logs tail command to continue waiting for more logs indefinitely.

If you can provide debug logs (with sensitive info redacted) by adding --debug to the command then that might help provide more insight into the issue. Otherwise using the get-log-events command could serve as a workaround.

@tim-finnigan tim-finnigan added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. logs p2 This is a standard priority issue and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. logs p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants