Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subscription Filter not added to cloudformation stack

See original GitHub issue

❓ Subscription Filter Object not create relative CloudFormation resources

The Question

Using SubscriptionFilter object, the relative resource are not created in cloudformation stack. Relative error are not showed. Synth and deploy command doesn’t return any error.



  • **CDK CLI Version:1.13.1
  • **Module Version: aws-logs
  • **OS: MacOSX
  • **Language: Javascipt

Other information

Here is the code:

let cloudWatchGroup = cl_logs.LogGroup.fromLogGroupArn(this, 'lambda-log-group', res); let filterPattern = cl_logs.FilterPattern.allEvents(); const subscriptionFilter = new cl_logs.SubscriptionFilter(this, 'elastic-search-subscription',{ destination: lambdaDestination, filterPattern: filterPattern, logGroup: cloudWatchGroup, }); `

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

nmussycommented, Oct 21, 2019

Alright, I’ve found the issue. The template is being initialized with outdated aws-cdk and @aws-cdk/core packages if your cdk CLI is outdated. Upgrading them solves the issue.

$ cdk --version
0.36.0 (build 6d38487)

$ cdk init --language javascript
Applying project template app for javascript
Executing npm install...
npm notice created a lockfile as package-lock.json. You should commit this file.

$ npm outdated
Package        Current   Wanted   Latest  Location
@aws-cdk/core   0.36.2   0.36.2   1.13.1  deploy
@types/node    8.10.45  8.10.45  12.11.1  deploy
aws-cdk         0.36.2   0.36.2   1.13.1  deploy

$ npm i aws-cdk@latest @aws-cdk/core@latest
+ aws-cdk@1.13.1
+ @aws-cdk/core@1.13.1

$ npm outdated
Package      Current   Wanted   Latest  Location
@types/node  8.10.45  8.10.45  12.11.1  deploy

I’m used to using local packages with npx, which is why mine is so old. Yours is probably more recent, but doesn’t have the recently merged #2821, which removed _references from ConstructNode.

To upgrade your global CDK CLI version:

npm i -g aws-cdk@latest

Not sure what we should do about this issue.

nmussycommented, Oct 17, 2019

Hey @fedeBollo,

Trying to read your reproduction stack was a little hard, so here is what I came up with, tell me if I’m too far off your use-case:

import {FilterPattern, LogGroup, SubscriptionFilter} from '@aws-cdk/aws-logs';
import {Code, Function as LambdaFn, Runtime} from '@aws-cdk/aws-lambda';
import {LambdaDestination} from '@aws-cdk/aws-logs-destinations';
import {Construct, Stack, StackProps} from '@aws-cdk/core';
// ...
const cloudWatchGroup = LogGroup.fromLogGroupArn(

const filterPattern = FilterPattern.allEvents();

const lambda = new LambdaFn(this, 'function', {
  runtime: Runtime.NODEJS_8_10,
  handler: 'hello.handler',
  code: Code.fromInline('() => {}'),

new SubscriptionFilter(this, 'elastic-search-subscription', {
  destination: new LambdaDestination(lambda),
  filterPattern: filterPattern,
  logGroup: cloudWatchGroup,

When I run cdk synth, I get the following:

// ...
    Type: AWS::Logs::SubscriptionFilter
          - functionF19B1A04
          - Arn
      FilterPattern: ""
      LogGroupName: test
      aws:cdk:path: TestStack10/elastic-search-subscription/Resource

Is this not what you are getting?

EDIT: I’ve edited my example to use a valid log group ARN, without it the logGroupName property wasn’t set.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::Logs::SubscriptionFilter - AWS CloudFormation
Subscription filters allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination.
Read more >
Cannot set up a SubscriptionFilter with cloud formation
I have an issue regarding setting up a subscription filter with cloudformation. This is how my CF file looks like
Read more >
AWS::Logs::SubscriptionFilter - Amazon CloudFormation
Subscription filters allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination.
Read more >
Datadog Forwarder
Find the datadog-forwarder (if you didn't rename it) CloudFormation stack. ... Manually migrate a few triggers (CloudWatch log group subscription filter and ...
Read more >
Amazon CloudWatch Logs
Collect CloudWatch Logs using a CloudFormation Template​ ... SumoCWLogGroup, A log group that has a subscription filter ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found