fix(logs): reject filtering nonexistent log groups (#6372)

Check the scoped log group before parsing a FilterLogEvents pattern. Reuse the missing-group error and cover missing, deleted, empty and populated groups through service and SDK tests.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
Andre Kurait authored and GitHub committed 2026-10-23 15:04:18 -04:00
1 parent 2cda0110a6
commit f50a698ab7
3 files changed
+116

No files matched your search

@@ -980,6 +980,10 @@ public class CloudWatchLogsService implements ResourceProvider, Resettable {
Long startTime, Long endTime,
String filterPattern, int limit,
String nextToken, String region) {
groupStore.get(groupKey(region, groupName))
.filter(stored -> groupName.equals(stored.getLogGroupName()))
.orElseThrow(CloudWatchLogsService::logGroupNotFound);
int maxEvents = Math.min(limit > 0 ? limit : Integer.MAX_VALUE,
maxEventsPerQuery);
// The filter pattern syntax metric and subscription filters use: terms, quoted phrases,