serverless icon indicating copy to clipboard operation
serverless copied to clipboard

Add configuration for CloudWatch Log for choosing LogGroupClass

Open davidsoendoro opened this issue 2 years ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched existing issues, it hasn't been reported yet

Use case description

AWS CloudWatch Log has just released a new option for log class at the 26th of November 2023. The new option is to use Infrequent Access log type on storing the logs in CloudWatch. This option is suitable for those who are not using features of CloudWatch Logs other than storing the logs as it enables 50% lower cost for data ingestion. Full announcement of the release is available here

Proposed solution (optional)

Add an additional configuration in the AWS function

functions:
  myCloudWatchLog:
    handler: myCloudWatchLog.handler
    events:
      - cloudwatchLog:
          logGroup: '/aws/lambda/hello'
          filter: '{$.userIdentity.type = Root}'
          logClass: 'Infrequent Access'

Which value will be used in the CloudFormation LogGroupClass as described here. Example:

{
  "Type" : "AWS::Logs::LogGroup",
  "Properties" : {
      "DataProtectionPolicy" : Json,
      "KmsKeyId" : String,
      "LogGroupClass" : String,
      "LogGroupName" : String,
      "RetentionInDays" : Integer,
      "Tags" : [ Tag, ... ]
    }
}

davidsoendoro avatar Nov 28 '23 05:11 davidsoendoro

related: https://github.com/serverless/serverless/issues/12264

JaredAAT avatar Dec 07 '23 08:12 JaredAAT

related: #12264

Jared I don’t think it’s related, it’s talking about some other logging feature.

davidsoendoro avatar Dec 08 '23 07:12 davidsoendoro

@davidsoendoro please see this comment and confirm whether you agree on the mentioned approach

darcoli avatar Dec 18 '23 08:12 darcoli

I'm interested in the same feature. AWS introduced CloudWatch logs Infrequent Access storage class, offering less cost than the standard one. However, it seems the serverless framework still hasn't adapted the feature yet.

it would be nice to have it.

SadmiB avatar Jan 10 '24 10:01 SadmiB

Any update on this yet?

affanshahab avatar Mar 19 '24 17:03 affanshahab