JSPM

serverless-logstreaming

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q26127F
  • License MIT

Serverless Logstreaming Plugin - Stream logs to the loghandler function

Package Exports

  • serverless-logstreaming

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-logstreaming) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

⚡️ Serverless Logstreaming Plugin

serverless npm license dependencies

About

This Serverless plugin allows for simple streaming of logs through a given function with the popular Serverless Framework and AWS Lambda.

Configuration

  1. Add serverless-logstreaming to your serverless.yml file in the root of your serverless project
plugins:
  - serverless-logstreaming
  1. Define permission for Cloudwatch to write to your loghandler:
resources:
  # AWS CloudFormation Template
  Resources:

    # IAM
    LoggingLambdaPermission:
      Type: AWS::Lambda::Permission
      Properties:
        FunctionName:
          Ref: LoghandlerLambdaFunction
        Action: lambda:InvokeFunction
        Principal: logs.amazonaws.com
  1. If you don't already have a loghandler defined somewhere in your stack, do so.
functions:
  loghandler:
    description: 'CW Logs handler for Tasks'
    handler: handlers/loghandler/handler.handler

And that's all it takes. Now the logs of all your lambda functions will stream through that loghandler

Acknowledgements

  • Thanks to @andymac4182 for the gist that inspired this plugin.
  • Thanks to @HyperBrain and the @serverless team