title: Can I set the default retention time for log groups created in a AWS CDK v2 created pipeline?
body: <p>I have an AWS VDK v2 based application stack that sets up a CodePipeline with different stages, application and all that, that works alright. But this setup creates quite some log-groups where the retention time is not set. As the log groups are not created by my cdk code, but under the hood by cdk itself, I cannot explicitly set the retention time.</p>
  <p>So I tried to use <code>Aspects</code> to achieve that. I created the following:</p>
  <pre class="lang-js prettyprint-override"><code>export class LogGroupRetentionChecker implements IAspect {
  
      prefix: String
  
      constructor(prefix: String) {
          this.prefix = prefix;
      }
  
      visit(node: IConstruct): void {
  
          console.log(`${(this.prefix)}: checking node ${node.constructor.name}`)
  
          if (node instanceof CfnResource) {
              console.log(`${this.prefix}: resource type ${node.cfnResourceType}`)
          }
  
          if (node instanceof CfnLogGroup) {
  
              console.log(`aspect found log-group ${node.logGroupName}, retention: ${node.retentionInDays}`);
  
              if (node.retentionInDays === undefined) {
                  node.retentionInDays = 60
              }
          }
      }
  }
  </code></pre>
  <p>At the place where the pipeline is created, I then do this:</p>
  <pre class="lang-js prettyprint-override"><code>Aspects.of(this.pipeline).add(new LogGroupRetentionChecker(&quot;pipeline&quot;));
  </code></pre>
  <p>And If have one more call where I create a stage. For the aspect on the pipleine this shows for example</p>
  <pre><code>pipeline: checking node CodePipeline
  pipeline: checking node Pipeline
  pipeline: checking node Key
  pipeline: checking node CfnKey
  pipeline: resource type AWS::KMS::Key
  pipeline: checking node Alias
  pipeline: checking node CfnAlias
  pipeline: resource type AWS::KMS::Alias
  pipeline: checking node Bucket
  pipeline: checking node CfnBucket
  pipeline: resource type AWS::S3::Bucket
  pipeline: checking node BucketPolicy
  pipeline: checking node CfnBucketPolicy
  pipeline: resource type AWS::S3::BucketPolicy
  pipeline: checking node Role
  pipeline: checking node CfnRole
  pipeline: resource type AWS::IAM::Role
  pipeline: checking node Policy
  pipeline: checking node CfnPolicyConditional
  pipeline: resource type AWS::IAM::Policy
  pipeline: checking node CfnPipeline
  pipeline: resource type AWS::CodePipeline::Pipeline
  pipeline: checking node Construct
  pipeline: checking node Construct
  pipeline: checking node Role
  pipeline: checking node CfnRole
  pipeline: resource type AWS::IAM::Role
  pipeline: checking node Policy
  pipeline: checking node CfnPolicyConditional
  pipeline: resource type AWS::IAM::Policy
  pipeline: checking node Construct
  
  ...
  
  </code></pre>
  <p>So the aspect is called, but none of the <code>IConstruct</code>s that are visited is a <code>CfnLogGroup</code>.</p>
  <p>My question now: How can I get these log-groups configured? If not by aspect, is there another way to do that?</p>