serverless-logstreaming

Serverless Logstreaming Plugin - Stream logs to the loghandler function


Keywords
serverless plugin logstreaming, serverless framework plugin, serverless applications, serverless plugins, cloudwatch, aws cloudwatch, lambda, aws, aws lambda, amazon, amazon web services, serverless.com, logs
License
MIT
Install
npm install serverless-logstreaming@1.1.3

Documentation

⚡️ 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.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