Repository navigation
fix(cloud-aws-cloudwatchlogs): fix paws custom mode for get-logs and list-groups - #6538
Open
rmorandell-pgum wants to merge 1 commit into
Open
rmorandell-pgum wants to merge 1 commit into
rmorandell-pgum wants to merge 1 commit into
Conversation
…list-groups - paws: read the Events field of FilterLogEvents (get-logs always found 0 events) - paws: pass --stream-name to FilterLogEvents (the filter was ignored) - paws: return log groups and events with the same keys as awscli - paws: support --endpoint for CloudWatch Logs and document the option - list-groups: sorted output, group names also with paws in --disco-show - add robot tests for get-logs and list-groups with paws (Mockoon) and awscli
rmorandell-pgum
requested review from
jean-christophe81 and
omercier
and removed request for
a team
November 11, 2026 15:07
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Community contributors
Description
With
--custommode=paws, the modesget-logsandlist-groupsof the CloudWatch Logs plugin (cloud::aws::cloudwatchlogs::plugin) do not work:get-logsnever sees any log event, so it is alwaysOK: 0 problem(s) detected, andlist-groups --disco-showhas no group names. Theawsclicustom mode is not affected. This PR fixes the paws custom mode so that both custom modes return the same results.Root causes in
src/cloud/aws/custom/paws.pm:cloudwatchlogs_filter_log_eventsreads the fieldlogGroupsof theFilterLogEventsanswer instead ofEvents, so it never returns an event.--stream-nameis ignored: the mode passesstream_names, but the paws custom mode reads$options{LogStreamNames}.LogGroupName,LogStreamName,Timestamp,Message), while the modes expect the keys of the aws CLI JSON output (logGroupName,logStreamName,timestamp,message).list-groupshandled both cases for its text output only,--disco-showusedlogGroupNameand stayed empty with paws.--endpointoption of the paws custom mode (already used by thecloudtrailplugin) is not passed to the CloudWatch Logs service.Changes:
src/cloud/aws/custom/paws.pmcloudwatchlogs_service(): builds theCloudWatchLogsservice with the region and, if set,--endpoint.cloudwatchlogs_describe_log_groups()andcloudwatchlogs_filter_log_events()return the same keys as the awscli custom mode, readEvents, passLogStreamNamesfromstream_namesand keep paginating withNextToken.--endpointis documented in the help.src/cloud/aws/cloudwatchlogs/mode/listgroups.pm:manage_selection()returns the sorted list of group names for both custom modes, used by the text output and by--disco-show.awsclicustom mode, to theget-logsmode or to the options. With awscli, the only visible change is that thelist-groupsoutput is now sorted.Fixes # (no existing issue)
Type of change
How this pull request can be tested ?
New Robot Framework tests in
tests/cloud/aws/cloudwatchlogs/. Every case runs with both custom modes, so the tests also check that paws and awscli give the same results:listgroups.robot(5 cases): text output,--disco-format,--disco-show.getlogs.robot(11 cases): no status threshold,--warning-status/--critical-statuson%{message},--stream-namefilter, status on%{stream_name}.cloud-aws-cloudwatchlogs.json, reached with--endpoint=http://localhost:3000/logs/.... It answersDescribeLogGroupsandFilterLogEventsand returns only the events ofapp-stream-2when the request body containslogStreamNames.awscommand inbin/(--command-path) that prints the JSON fixtures ofdata/.demo-*log groups,key/secretcredentials).