CloudWatch: Status 400 while trying to deploy CDK with AWS logs MetricFilter
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
Since a few days ago we are getting periodic deployment errors when trying to deploy using C# CDK. We're adding a metric filter for AWS logs to an alarm trigger for a lambda function and the call during stack deployment fails with the following error:
```
"Invalid request provided: AWS::Logs::MetricFilter. Regular expression evaluation time exceeded allowed limit (Service: CloudWatchLogs, Status Code: 400, Request ID: 93a33fa3-1826-43b3-b4bc-4d32f18aebbd) (SDK Attempt Count: 1)"
```
When retrying deployment, sometimes it succeeds.
We have multiple alarm triggers with the same metric filter and same regular expression and it keeps randomly failing for one of those definitions.
The regular expression filter pattern for the metric filter is: `%Task timed out after|^REPORT\s.+\sStatus: timeout%`.
This has worked for many months without issues.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Library Version
_No response_
### Expected Behavior
No errors
### Current Behavior
See above
### Reproduction Steps
See above
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### AWS CDK Library version (aws-cdk-lib)
2.214.0
### AWS CDK CLI version
2.1104.0
### Node.js Version
20
### OS
Windows
### Language
.NET
### Language Version
8
### Other information
_No response_
Contributor guide
Research direction
No repository files or tests are named. Start by reproducing the CDK deployment with aws-cdk-lib 2.214.0, the AWS::Logs::MetricFilter pattern `%Task timed out after|^REPORT\s.+\sStatus: timeout%`, and the reported .NET environment; compare repeated deployments and the resulting CloudWatch Logs error. Done means the intermittent Status 400 failure is resolved or its cause and scope are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, csharp
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100