This Serverless Framework plugin manages the API Gateway execution log groups automatically created in CloudWatch when execution logging is enabled in serverless.yml
. When enabling these logs, API Gateway automatically creates a CloudWatch log group named API-Gateway-Execution-Logs_[RestApiId]/[stage]
. This log group is not part of the CloudFormation stack deployed by Serverless Framework.
The plugin does the following:
- applies the log retention policy configured in serverless.yml (by default the API Gateway execution log group is configured with Expire=Never)
- deletes the log group upon stack removal
npm install serverless-api-gateway-execution-log-manager --save-dev
Version 1.1.1 is compatible with Serverless Framework v3, but it uses the legacy logging interface. Version 2.0.0 and later uses the new logging interface.
serverless-api-gateway-execution-log-manager | Serverless Framework |
---|---|
≤ v1.1.0 | v1.x, v2.x |
v1.1.1 | v1.x, v2.x, v3.x |
≥ v2.0.0 | v3.x |
Add the following to your serverless.yml
:
plugins:
- serverless-api-gateway-execution-log-manager
provider:
logs:
restApi:
level: INFO
executionLogging: true
fullExecutionData: true
logRetentionInDays: 7 # also applied to the execution logs with the plugin
This plugin does not have any configuration options (yet).