serverless-apigateway-access-logs

2.0.0 • 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.

/serverless-apigateway-access-logs/

    Package Sidebar

    Install

    npm i serverless-apigateway-access-logs

    Weekly Downloads

    459

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    4.52 kB

    Total Files

    3

    Last publish

    Collaborators

    • huynguyen9898
    • yasmine.abdelkefi
    • wernerd
    • antonia.balluais
    • youssef.ezzahi
    • emeline75
    • ghazicoorpacademy
    • silou
    • coorpadmin
    • esa-coorp
    • adriean.khisbe
    • adamska27
    • audric-coorp
    • djamelsoualmi
    • stefanocoorp
    • emorana
    • dfazage
    • godu