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
About
This Serverless plugin allows for simple streaming of logs through a given function with the popular Serverless Framework and AWS Lambda.
Configuration
- Add
serverless-logstreaming
to yourserverless.yml
file in the root of your serverless project
plugins:
- serverless-logstreaming
- 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
- 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