Package Exports
- serverless-apigateway-access-logs
- serverless-apigateway-access-logs/src/index.js
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-access-logs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
serverless-apigateway-access-logs
This Serverless-apigateway-access-logs plugin enables you to configure AWS API gateway access logs.
Installation
First, add `serverless-apigateway-access-logs to your project:
npm install serverless-apigateway-access-logsThen inside your project's serverless.yml file, add following entry to the plugins section
plugins:
- serverless-apigateway-access-logs
Configuration
Plugin need to be configured with a log group, and a format. Log group just need a name, plugins takes care to ensure CloudWatchLogGroup creation.
To configure it, add something like the following to your serverless.yml.
custom:
serverless-apigateway-access-logs:
format: '{ "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "caller":"$context.identity.caller", "user":"$context.identity.user","requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","resourcePath":"$context.resourcePath", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength" }'
log-group: /aws/my-api/${self:provider.stage}/access-logs
log-group-retention: 14 # optional, default to 7You can also additionnaly add a stageTags mapping to have some tags attached to the API gateway stage.