aws-sdk-kotlin icon indicating copy to clipboard operation
aws-sdk-kotlin copied to clipboard

CloudWatch Logs's GetLogEvents paginator never terminates

Open ianbotsf opened this issue 1 year ago • 0 comments

Describe the bug

The CloudWatch Logs client supports a paginator over GetLogEvents but using this paginator yields a never-ending Flow. The service API documentation describes how the pagination token returned will be the same as the input token when there are no more records to retrieve. Our pagination logic won't handle this case and will basically continue issuing subsequent API calls which yield empty responses for logs which are no longer actively appending.

Expected behavior

Other SDKs (e.g., Java v2, JS v3) have added customizations which handle GetLogEvents's non-standard pagination. We should investigate doing the same.

Current behavior

See above.

Steps to Reproduce

cloudWatchLogsClient
    .getLogEventsPaginated {
        logGroupName = "..."
        logStreamName = "..."
    }
    .collect { println("Page of log events: ${it.events?.size} records, nextToken = ${it.nextForwardToken}") }

Possible Solution

No response

Context

No response

AWS SDK for Kotlin version

1.2.28

Platform (JVM/JS/Native)

JVM

Operating system and version

any

ianbotsf avatar Jun 07 '24 19:06 ianbotsf