When you're building Lambda functions with CDK, you can't always guess the log prefix, and even if you can, it's a bit unweildy.
For example, with a CDK stack with logical ID "NodeCountExampleAwsLambdaStack" and a Lambda function called "CountGetFunction", CDK generates a CloudWatch Log Group of:
Note how "NodeCountExampleAwsLambdaStack" is truncated to "NodeCountExampleAwsLambda". There are also limits on the function logical ID.
To save me from having to use saw groups | grep CountGet, then copy / paste the outputted group name so that I can run saw get <groupname>, I thought it would be helpful to be able to "fuzzy search" the group name.
So in this PR, I've implemented a basic "contains substring" search for the log group that's only triggered when a --fuzzy flag is set.
You can get the logs directly with:
saw --fuzzy CountGet
Compared to:
saw get /aws/lambda/NodeCountExampleAwsLambda-CountGetFunctionD35D8410....
Obviously, it costs a CloudWatch Log API call or two if you use the fuzzy search flag, but it's not the default behaviour so won't affect anyone that doesn't use it.
When you're building Lambda functions with CDK, you can't always guess the log prefix, and even if you can, it's a bit unweildy.
For example, with a CDK stack with logical ID "NodeCountExampleAwsLambdaStack" and a Lambda function called "CountGetFunction", CDK generates a CloudWatch Log Group of:
Note how "NodeCountExampleAwsLambdaStack" is truncated to "NodeCountExampleAwsLambda". There are also limits on the function logical ID.
To save me from having to use
saw groups | grep CountGet
, then copy / paste the outputted group name so that I can runsaw get <groupname>
, I thought it would be helpful to be able to "fuzzy search" the group name.So in this PR, I've implemented a basic "contains substring" search for the log group that's only triggered when a
--fuzzy
flag is set.You can get the logs directly with:
Compared to:
Obviously, it costs a CloudWatch Log API call or two if you use the fuzzy search flag, but it's not the default behaviour so won't affect anyone that doesn't use it.