JSPM

serverless-apigateway-log-retention

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8625
  • Score
    100M100P100Q142503F
  • License MIT

A plugin for the Serverless framework which configures ApiGateway access adn execution log retention.

Package Exports

  • serverless-apigateway-log-retention

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-apigateway-log-retention) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ApiGateway Log Retention

Control the retention of your ApiGateway access logs and execution logs.

Installation

From your target serverless project, run:

npm install serverless-apigateway-log-retention

Add the plugin to your serverless.yml:

plugins:
  - serverless-apigateway-log-retention

Configuration

Configuration happens 'globally' via custom.apigatewayLogRetention

PLEASE NOTE THAT THE PLUGIN REQUIRES THE FOLLOWING AWS PERMISSIONS:

CloudWatch Logs

  • putRetentionPolicy
  • deleteRetentionPolicy

ApiGateway

  • getRestApis
  • getStage

Plugin Options

accessLogging.enabled (optional) - Whether or not to update access logging retention policy. Set to false by default.

accessLogging.days (required) - Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653 and 'never expire'.

executionLogging.enabled (optional) - Whether or not to update execution logging retention policy. Set to false by default.

executionLogging.days (required) - Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653 and 'never expire'.

Examples

serverless.yml - Enabled for execution logging and disabled for access logging:

service: sample

plugins:
  - serverless-apigateway-log-retention

provider:
  name: aws

custom:
  apigatewayLogRetention:
    executionLogging:
      enabled: true
      days: 'never expire'


serverless.yml - Enabled for access logging and execution logging:

service: sample

plugins:
  - serverless-apigateway-log-retention

provider:
  name: aws

custom:
  apigatewayLogRetention:
    executionLogging:
      enabled: true
      days: 14
    accessLogging:
      enabled: true
      days: 7

Note: This plugin might not be suitable if you have over 500 APIs in the region you are deploying to.