Miss any of our Open RFC calls?Watch the recordings here! »

serverless-apigateway-access-logs

0.2.5 • Public • Published

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-logs

Then inside your project's serverless.yml file, add following entry to the plugins section

plugins:
  - serverless-apigateway-access-logs

See example

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 7

You can also additionnaly add a stageTags mapping to have some tags attached to the API gateway stage.

Install

npm i serverless-apigateway-access-logs

DownloadsWeekly Downloads

437

Version

0.2.5

License

MIT

Unpacked Size

4.48 kB

Total Files

3

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar