Skip to content

Commit

Permalink
Add FunctionLogs log group with retention time
Browse files Browse the repository at this point in the history
Better to have logs expire than not. Two weeks seems ample.
  • Loading branch information
mbland committed Jun 5, 2023
1 parent 6c2ce78 commit a75e054
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions template.yaml
Expand Up @@ -23,9 +23,11 @@ Resources:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Metadata:
BuildMethod: makefile
DependsOn: FunctionLogs
Properties:
Handler: ses-forwarder-lambda
Runtime: go1.x
FunctionName: !Sub "${AWS::StackName}-function"
Policies:
- AWSLambdaBasicExecutionRole
- Statement:
Expand All @@ -52,6 +54,14 @@ Resources:
FORWARDING_ADDRESS: !Ref ForwardingAddress
CONFIGURATION_SET: !Ref SendingConfigurationSet

FunctionLogs:
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-logs-loggroup-retentionindays
# https://awslabs.github.io/serverless-rules/rules/lambda/log_retention/
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-function"
RetentionInDays: 14

BucketPutPolicy:
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-policy.html
Type: AWS::S3::BucketPolicy
Expand Down

0 comments on commit a75e054

Please sign in to comment.