Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWSLogs Resource Limit Exceeded - serverless `cloudwatchLog` event

I'm trying to add the cloudwatchLog event to my lambda function and am getting an unexpected error. The error message is not very descriptive. Does anyone know what is going on?

Config:

functions:
  helloWorld:
    handler: dist/handlers/index.helloWorld
    events:
      - cloudwatchLog:
          logGroup: '/aws/lambda/serverless-test-package-4-dev-supWorld'

Error Message:

Serverless Error ---------------------------------------

An error occurred: HelloWorldLogsSubscriptionFilterCloudWatchLog1 - 
Resource limit exceeded. (Service: AWSLogs; Status Code: 400; Error 
Code: LimitExceededException; Request ID: e30b438c-a654-11e8-837a-7f86cfddec76).

Get Support --------------------------------------------
   Docs:          docs.serverless.com
   Bugs:          github.com/serverless/serverless/issues
   Forums:        forum.serverless.com
   Chat:          gitter.im/serverless/serverless

Your Environment Information -----------------------------
   OS:                     linux
   Node Version:           8.11.3
   Serverless Version:     1.26.1
like image 994
Ulad Kasach Avatar asked Aug 22 '18 21:08

Ulad Kasach


2 Answers

The problem was that there was already a lambda which had the CloudWatchLog event subscription. AWS limits each CloudWatch Log Group to a maximum of one subscription, as specified by the last row of this documentation.

like image 159
Ulad Kasach Avatar answered Nov 11 '22 19:11

Ulad Kasach


To solve this you have to remove the already attached subscription from the log group. Just removing the cloudwatchLog event from lambda and deploying will remove the subscription from the log group. You can then add the cloudwatchLog event for the required log group and deploy it again.

like image 29
Jishnu Avatar answered Nov 11 '22 21:11

Jishnu