serverless/serverless

Log retention not properly set for Lambda@Edge functions

Aperta

#7574 aperta il 13 apr 2020

 (8 commenti) (7 reazioni) (0 assegnatari)JavaScript (5734 fork)batch import
bugcat/aws-event-cloudfronthelp wantedneeds feedback

Metriche repository

Star
 (46.915 stelle)
Metriche merge PR
 (Merge medio 1g 15h) (34 PR mergiate in 30 g)

Descrizione

Bug Report

Description

  1. What did you do?

I created a Lambda@Edge deployment and set the log retention to 30 days.

  1. What happened?

The standard log group for the function /aws/lambda/my-function in us-east-1 has its retention policy properly set, this log group is not actually used as Lambda@Edge logs to groups in the region where the lambda is actually called/executed.

  1. What should've happened?

The log groups in each region named /aws/lambda/us-east-1.my-function should also have the retention set.

  1. What's the content of your serverless.yml file?

Relevant parts are:

service: my-service

provider:
  name: aws
  runtime: nodejs10.x
  stage: ${opt:stage, 'dev'}
  region: us-east-1
  logRetentionInDays: 30

functions:
  my-function:
    handler: index.handler
    
plugins:
  - '@silvermine/serverless-plugin-cloudfront-lambda-edge'
  1. What's the output you get when you use the SLS_DEBUG=* environment variable (e.g. SLS_DEBUG=* serverless deploy)

N/A

Similar or dependent issues:

https://forum.serverless.com/t/lambda-edge-log-retention-and-serverless-dashboard-monitoring/9913

It looks like this is possible through CloudFormation:

https://stackoverflow.com/questions/45364967/set-expiration-of-cloudwatch-log-group-for-lambda-function

Guida contributor