-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CloudWatch logs get_log_events pager seems to loop indefinitley #712
Comments
Thats for reporting the issue. This is not intended behavior. I'm going to look at this more, and hopefully get a fix shortly. |
I've been looking into this. It appears, unlike other services, that cloud watch logs is using the marker to allow continuations, even when there are no more results at the current point in time. For the SDK to handle this generically, the paginators would need to maintain the paging tokens from the previous response and compare them to the current ones to determine if there are any more results. I'm going to discuss this with a few team members and hopefully put together a solution. Thank you for your patience. |
No worries. For the moment I've just been doing this which seems to get around the issue:
|
I have a working patch, but I'm doing some more research to ensure that echoing the same token is not a valid pattern elsewhere. |
I re-worked the patch (e02eb99), this version is a much smaller code change, and is easier to follow. I'm much happier with the result and I think it satisfies the required change without breaking existing tests. The previous commit had some test failures. |
Closed by #730. This will be part of our next release. Thanks for submitting an excellent bug report and for your patience! |
I'm having some trouble using get_log_events with the .each do |response| pager functionality.
Basically it seems to loop indefinitely.
Here's a basic example:
If you replace log_stream_name with your own log stream name this should print all events from 1 day ago to 3 days ago.
For me that returns:
After which I kill the process. As you can see it returns all the logs in the first iteration, then returns 0 logs and identical next/previous tokens and continues looping.
Is this intended behaviour?
If this is not intended then I suspect the issue could be the actual REST API rather than the Ruby SDK.
For example if you run this using the AWS CLI:
You'll get something like:
In that example the next-token supplied is outside the time range but it still returns a next token leaving the SDK to believe there's still records.
This could probably be resolved in the Ruby SDK by ending the iteration when the next token equals the back token.
The text was updated successfully, but these errors were encountered: