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 · 4 comments
Open

aws logs tail --follow never exits #8576

BeyondEvil opened this issue Mar 13, 2024 · 4 comments
Assignees
Labels
bug This issue is a bug. logs p2 This is a standard priority issue

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
Copy link

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label May 25, 2024
@BeyondEvil
Copy link
Author

Sorry for the late response.

I'll make sure I'm on the latest version(s) and repro with the --debug flag.

Stay tuned.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels May 26, 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
Projects
None yet
Development

No branches or pull requests

3 participants