Skip to content

aws-lambda: logRetention deprecation messages for Provider or CustomResource (most likely) #28806

@holomekc

Description

@holomekc

Describe the bug

After the deprecation of logRetention, we migrated the usage to logGroup. Sadly our logs are still full of deprecation warnings. After some debugging our assumption is that this is related to either the Provider or CustomResource construct. We tried to remove logRetention from Provider, but this does not help and there is no logGroup method available. So I assume somewhere under the hood you guys also still use logRetention.

Expected Behavior

AWS CDK internally also does not use logRetention anymore, or at least the warnings are not shown in this case.

Current Behavior

Logs are full of:

[WARNING] aws-cdk-lib.aws_lambda.FunctionOptions#logRetention is deprecated.
  instead create a fully customizable log group with `logs.LogGroup` and use the `logGroup` property to instruct the Lambda function to send logs to it.
Migrating from `logRetention` to `logGroup` will cause the name of the log group to change.
Users and code and referencing the name verbatim will have to adjust.

In AWS CDK code, you can access the log group name directly from the LogGroup construct:
\```ts
declare const myLogGroup: logs.LogGroup;
myLogGroup.logGroupName;
\```
  This API will be removed in the next major release.

Reproduction Steps

As said I did not check your code, but the assumption is when using Provider in combination with CustomResource creates this issue.

Possible Solution

  • Migrate the internal code to logGroup as well
  • Make sure that the logs are not flooded

Additional Information/Context

No response

CDK CLI Version

2.122.0

Framework Version

No response

Node.js Version

20.11.0

OS

OSX

Language

Java

Language Version

Java 17

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-logsRelated to Amazon CloudWatch LogsbugThis issue is a bug.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions