Describe the feature
FilterPattern.stringValue should allow the user to specify if the value input field is a regex string or not.
Use Case
According to CloudWatch filter pattern documentation, regex expressions must be surrounded by %.
I'm trying to use cdk's FilterPattern.stringValue to match a json document.
CDK automatically adds double quotes in the final filter pattern, which prevents Cloudwatch from recognizing any string as a regex pattern. For example:
- Correct: { $.foo = %bar% }
- Incorrect: { $.foo = “%bar%” }, what is produced by CDK and does not match the document : {“foo”:“bar”}
Proposed Solution
Reason for this behavior may be this line: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-logs/lib/pattern.ts#L399. Perhaps we need another input to stringValue that allows the user to specify if the input string is a regex pattern or not.
Other Information
No response
Acknowledgements
CDK version used
2.144.0
Environment details (OS name and version, etc.)
Linux
Describe the feature
FilterPattern.stringValue should allow the user to specify if the
valueinput field is a regex string or not.Use Case
According to CloudWatch filter pattern documentation, regex expressions must be surrounded by
%.I'm trying to use cdk's FilterPattern.stringValue to match a json document.
CDK automatically adds double quotes in the final filter pattern, which prevents Cloudwatch from recognizing any string as a regex pattern. For example:
Proposed Solution
Reason for this behavior may be this line: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-logs/lib/pattern.ts#L399. Perhaps we need another input to
stringValuethat allows the user to specify if the input string is a regex pattern or not.Other Information
No response
Acknowledgements
CDK version used
2.144.0
Environment details (OS name and version, etc.)
Linux