Garret Harp
10/21/2021, 6:00 PMGarret Harp
10/21/2021, 6:15 PMFrank
logRetentionRetryOptions
a try? https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html#logretentionretryoptionsFrank
maxRetries
to 100 just to test it out and see if it works.Frank
Frank
Garret Harp
10/21/2021, 6:40 PMGarret Harp
10/21/2021, 6:54 PMGarret Harp
10/21/2021, 8:05 PMGarret Harp
10/21/2021, 8:06 PMthis.getAllFunctions().forEach(func => {
new logs.LogGroup(this, `${func.node.id}-LogGroup`, {
logGroupName: `/aws/lambda/${func.functionName}`,
retention: logs.RetentionDays.THREE_MONTHS,
removalPolicy: scope.defaultRemovalPolicy
})
})
Ömer Toraman
10/21/2021, 9:36 PMÖmer Toraman
10/21/2021, 9:37 PMGarret Harp
10/21/2021, 9:42 PMGarret Harp
10/21/2021, 9:42 PMFrank
Garret Harp
10/21/2021, 9:48 PMReceived response status [FAILED] from custom resource. Message returned: A conflicting operation is currently in progress against this resource. Please try again. (RequestId: 27daaaf0-f4b5-472d-8cae-643d3664f740)
Frank
conflicting operation
error and rewrite the custom resource ourselves. https://github.com/serverless-stack/serverless-stack/issues/953Ömer Toraman
10/24/2021, 2:31 AMÖmer Toraman
10/24/2021, 2:35 AMimport * as sst from '@serverless-stack/resources'
import logs from '@aws-cdk/aws-logs'
export class MainStack extends sst.Stack {
constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props);
const api = new sst.Api(this, "Api", {
routes: {
"POST /todo": {
srcPath: 'src/handlers/apiGateway/todo/',
handler: 'post-todo.handler',
functionName: 'postTodo',
description: 'Creates a new post'
}
},
});
this.getAllFunctions().forEach(func => {
const { stage, name } = scope
const logGroupNamePrefix = `${stage}-${name}-${id}`
new logs.LogGroup(this, `${func.node.id}-LogGroup`, {
logGroupName: `/aws/lambda/${logGroupNamePrefix}/${func.functionName}`,
retention: logs.RetentionDays.ONE_MONTH,
removalPolicy: scope.defaultRemovalPolicy
})
})
this.addOutputs({
ApiEndpoint: {
value: api.url,
description: 'The HTTP Endpoint'
}
});
}
}
And this in return creates two log groups:
/aws/lambda/post*Todo*
and /aws/lambda/test-app-middy/post*Todo*
And the logs that come from the function are ingested by /aws/lambda/postTodo
group. /aws/lambda/test-app-middy/postTodo
, which is the one I’m manually creating has no stream.Garret Harp
10/24/2021, 5:57 PM/aws/lambda/{functionName}
Ömer Toraman
10/24/2021, 10:17 PM