Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cfn-lint] WS1004 incorrectly reported #190

Open
shawnbucholtz opened this issue Mar 21, 2024 · 1 comment
Open

[cfn-lint] WS1004 incorrectly reported #190

shawnbucholtz opened this issue Mar 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@shawnbucholtz
Copy link

What were you trying to accomplish?

Resolve warnings. See aws-cloudformation/cfn-lint#3103

cfn-lint incorrectly reports:

[cfn-lint] WS1004: Lambda function xxx does not have a corresponding log group with a Retention property

Expected Behavior

When there is an explicit !Ref to a defined log group with the RetentionInDays property set then WS1004 should not be flagged, unless I am misunderstanding the warning.

Current Behavior

Warning about WS1004 despite having a log group with a retention property referenced.

Possible Solution

Manual solution is adding .cfnlintrc.yaml to ignore the warning.

Steps to Reproduce (for bugs)

Run cfn-lint with the serverless template below:

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31

Resources:

  LambdaProxyFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: src/
      FunctionName: MyFunction
      Handler: index.handler
      LoggingConfig:
        LogFormat: JSON
        LogGroup: !Ref LambdaProxyLogGroup
      MemorySize: 512
      PackageType: Zip
      ReservedConcurrentExecutions: 1
      Runtime: nodejs18.x
      Timeout: 10
      Tracing: Active

  LambdaProxyLogGroup:
    DeletionPolicy: Retain
    UpdateReplacePolicy: Retain
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupClass: STANDARD
      RetentionInDays: 180

Environment

Python 3.8.10
cfn-lint 0.86.0
cfn-lint-serverless 0.3.2

Log to large to paste, attached instead.

out.log

@shawnbucholtz shawnbucholtz added the bug Something isn't working label Mar 21, 2024
@michael-k
Copy link

The warning was valid until November 2023, see this announcement: https://aws.amazon.com/about-aws/whats-new/2023/11/aws-lambda-controls-search-filter-aggregate-lambda-function-logs/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants