Lets you configure custom log group, JSON logging, and other recent logging changes announce in Nov 2023.
For more information about these settings, please see the service announcement here
- Install as dev dependency:
npm i --save-dev serverless-logging-config
- Add the plugin to the plugins list in your
serverless.yml
:
service: my-service
plugins:
- serverless-logging-config
- Configure the plugin in the
custom
section (you may have to add this to yourserverless.yml
). For example:
service: my-service
custom:
serverless-logging-config:
enableJson: true # [Optional] if enabled, set the LogFormat to JSON
logGroupName: my-logs # [Optional] if set, all functions will send logs this log group
applicationLogLevel: INFO # [Optional] valid values are DEBUG, ERROR, FATAL, INFO, TRACE and WARN
systemLogLevel: INFO # [Optional] valid values are DEBUG, INFO and WARN
useDefaultLogGroup: # [Optional] these functions would keep logging to their default log group
- function1
- function2
See this page for more info on what these settings mean.
IMPORTANT: when used alongside the serverless-iam-roles-per-function
plugin, make sure this plugin is listed AFTER serverless-iam-roles-per-function
. ie.
plugins:
- serverless-iam-roles-per-function
- serverless-logging-config