默认情况下,当我创建 Lambda 函数时,CloudWatch 日志组设置为永不过期。是否可以设置过期时间(比如 14 天),这样我就不必在创建后从控制台手动设置它?
更新#1
感谢@jens walter 的回答,这是如何解决问题的代码片段
Resources:
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs6.10
CodeUri: <your code uri>
Policies: <your policies>
LambdaFunctionLogGroup:
Type: "AWS::Logs::LogGroup"
DependsOn: "LambdaFunction"
Properties:
RetentionInDays: 14
LogGroupName: !Join ["", ["/aws/lambda/", !Ref LambdaFunction]]