Lets you configure custom log group, JSON logging, and other recent logging changes announce in Nov 2023.
npm install serverless-logging-configLets 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
1. Install as dev dependency:
npm i --save-dev serverless-logging-config
2. Add the plugin to the plugins list in your serverless.yml:
``yml
service: my-service
plugins:
- serverless-logging-config
`
3. Configure the plugin in the custom section (you may have to add this to your serverless.yml). For example:
`yml
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.
`yml``
plugins:
- serverless-iam-roles-per-function
- serverless-logging-config