JSPM

serverless-logstreaming

1.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q27922F
  • 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

Currently this plugin ONLY works with the AWS provider.

  1. Add serverless-logstreaming to your serverless.yml file in the root of your serverless project
plugins:
  - serverless-logstreaming
  1. Define your loghandler function:
functions:
  myLogHandler:
    description: 'CW Logs handler for Tasks'
    handler: handlers/myLogHandler/handler.handler
  1. Reference the name of your loghandler function in the custom section:
custom:
  logHandler:
    function: myLogHandler

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

If you have a function where you don't want to stream logs through the loghandler it's as simple as adding an exception:

functions:
  handlerToNotStream:
    description: 'This lambda should not stream logs'
    loghandler: false

That loghandler: false will exempt this lambda from streaming through the loghandler function.

Changelog

  • 1.1.3 - Fix several permissions bugs. Remove unnecessary logFilter.
  • 1.1.0 - Add logstreaming permission by default instead of requiring user to do so, add flexibility in naming
  • 1.0.0 - Initial commit.

Acknowledgements

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