damp-school-17708
06/25/2021, 1:02 PM* Error creating Cloudwatch log subscription filter: ResourceNotFoundException: The specified log group does not exist.
We basically have a CW log subscription filter, which subscribes to a CW log, this is all on a lambda, when we create the lambda+log+subscription for the first time (before any invocation of the lambda) it always fails.
It's nothing too fancy, code is here:
const logGroup = new aws.cloudwatch.LogGroup(`log-group-${functionName}`, {
name: `/aws/lambda/${functionName}`,
retentionInDays: 30,
tags,
})
new aws.cloudwatch.LogSubscriptionFilter(`log-sub-${functionName}`, {
name: `log-sub-${functionName}`,
logGroup: logGroup,
filterPattern: '',
destinationArn: `arn:aws:lambda:${region}:998119384210:function:datadog-ForwarderStack-C97LY7AXPME-Forwarder-1I6FZ9UCEMET2`,
})
Once you invoke the function then the filter works, everything is fine