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

aws-cdk-lib/aws-logs: Setting logGroupAuditDestination causes deploy error #32108

Closed
1 task
JohanZackrisson opened this issue Nov 13, 2024 · 2 comments
Closed
1 task
Assignees
Labels
@aws-cdk/aws-logs Related to Amazon CloudWatch Logs bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@JohanZackrisson
Copy link

Describe the bug

When trying to setup a DataProtectionPolicy that has a logGroupAuditDestination set, the deploy is failing with
Failed to update CloudWatch Logs resource policy due to policy document length constraints

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

It should work as described in the documentation, or at least be better documented so that it can be set up properly.

Current Behavior

Deploy error
Failed to update CloudWatch Logs resource policy due to policy document length constraints

Reproduction Steps

const auditLogGroup = new logs.LogGroup(this, 'PolicyAudit');

const dataProtectionPolicy = new logs.DataProtectionPolicy({
  name: 'FilterLogs',
  description: 'Filter logs',
  identifiers: [
    logs.DataIdentifier.DRIVERSLICENSE_US,

  ],
  // works without, but not with this line                <----------------
  // logGroupAuditDestination: auditLogGroup,
});

const logGroup = new logs.LogGroup(this, 'Logs', {
  retention: logs.RetentionDays.ONE_MONTH,
  dataProtectionPolicy,
});

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

10.9.0

Framework Version

No response

Node.js Version

v22.11.0

OS

Mac os 14.7.1

Language

TypeScript

Language Version

typescript@5.3.3

Other information

No response

@JohanZackrisson JohanZackrisson added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 13, 2024
@github-actions github-actions bot added the @aws-cdk/aws-logs Related to Amazon CloudWatch Logs label Nov 13, 2024
@khushail khushail self-assigned this Nov 13, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Nov 13, 2024
@khushail
Copy link
Contributor

Hi @JohanZackrisson , thanks for reaching out.

The given code works fine for me and even succeeds in deployment. Sharing the code and relevant snippets -

Code -

    const auditLogGroup = new logs.LogGroup(this, 'PolicyAudit');

    const dataProtectionPolicy = new logs.DataProtectionPolicy({
      name: 'FilterLogs',
      description: 'Filter logs',
      identifiers: [
        logs.DataIdentifier.DRIVERSLICENSE_US,

      ],
      // uncommented , works with below line              <----------------
      logGroupAuditDestination: auditLogGroup,
    });

    const logGroup = new logs.LogGroup(this, 'Logs', {
      retention: logs.RetentionDays.ONE_MONTH,
      dataProtectionPolicy,
    });

    new cdk.CfnOutput(this, 'LogGroupArn', {
      value: logGroup.logGroupArn,
      });

Generated synth template -

{
 "Resources": {
  "PolicyAudit907D4D27": {
   "Type": "AWS::Logs::LogGroup",
   "Properties": {
    "RetentionInDays": 731
   },
   "UpdateReplacePolicy": "Retain",
   "DeletionPolicy": "Retain",
   "Metadata": {
    "aws:cdk:path": "LogIssueStack/PolicyAudit/Resource"
   }
  },
  "Logs6819BB44": {
   "Type": "AWS::Logs::LogGroup",
   "Properties": {
    "DataProtectionPolicy": {
     "name": "FilterLogs",
     "description": "Filter logs",
     "version": "2021-06-01",
     "configuration": {
      "customDataIdentifier": []
     },
     "statement": [
      {
       "sid": "audit-statement-cdk",
       "dataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/DriversLicense-US"
       ],
       "operation": {
        "audit": {
         "findingsDestination": {
          "cloudWatchLogs": {
           "logGroup": {
            "Ref": "PolicyAudit907D4D27"
           }
          }
         }
        }
       }
      },
      {
       "sid": "redact-statement-cdk",
       "dataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/DriversLicense-US"
       ],
       "operation": {
        "deidentify": {
         "maskConfig": {}
        }
       }
      }
     ]
    },
    "RetentionInDays": 30
   },
   "UpdateReplacePolicy": "Retain",
   "DeletionPolicy": "Retain",
   "Metadata": {
    "aws:cdk:path": "LogIssueStack/Logs/Resource"
   }
  },

Deployment-
Screenshot 2024-11-13 at 11 01 25 AM

Please see I am using CDK Version - 2.166.0.

Since I am not able to repro the issue, could you please share some more information which can be helpful to repro the mentioned scenario? Also pls check the CDK Version as well.

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Nov 13, 2024
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-logs Related to Amazon CloudWatch Logs bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants