Could you please provide information/link how can I create next via AWS SAM:
1. Go to services → CloudWatch → Rules → click on Create rule .
2. Event Source → choose Event Pattern → select CloudWatch Logs in Service Name , AWS API Call via CloudTrail in Event Type (If you don’t have Trail setup in CloudTrail, do first. To get help refer this document), CreateLogGroup in Specific operation(s)→ Targets → select Lambda function → select previously created lambda function → click on Configure details .
3. Give Name, Description, State should be enabled → click on Create rule .
(taken from https://medium.com/tensult/manage-aws-cloudwatch-log-group-retention-using-automation-26add478b0c5 article.)
I've not found any information how I can describe this Event Source / Event Type (AWS API Call via CloudTrail) for lambda function (step 2) in AWS SAM template.yaml file.
Sorry, if I provide not fully correct title to this question, I'm not sure how ask this properly - ping me, and I'll change it.