A Serverless Framework plugin (compatible with version 3.40.0 and earlier) to configure AWS Lambda logging options.
# NPM
npm install --save-dev serverless-configure-lambda-logs
# Or using the Serverless Framework plugin command
serverless plugin install -n serverless-configure-lambda-logs
If you want to develop or test this plugin locally:
- Clone this repository
- Install it locally in your project:
# In your Serverless project directory
npm install --save-dev /path/to/serverless-configure-lambda-logs
Add the plugin to your serverless.yml
file:
plugins:
- serverless-configure-lambda-logs
Configure log options globally for all functions:
custom:
logs:
format: json # 'json' or 'text' (default is 'text')
applicationLevel: INFO # 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL' (default is 'ERROR')
systemLevel: INFO # 'DEBUG', 'INFO', 'WARN' (default is 'WARN')
logGroup: /custom/log/group/path # Optional: specify a custom log group
Configure log options individually for each function:
functions:
hello:
handler: handler.hello
logs:
format: json
applicationLevel: DEBUG
systemLevel: DEBUG
logGroup: /custom/log/group/path
- Log configuration options with automatic CloudFormation injection
- Support for text and JSON log formats
- Configurable log levels
- Updates configurations via AWS SDK
- Support for custom log groups
- NEW in 1.0.7: Compatibility with serverless-plugin-split-stacks
- TRACE: Most detailed information for debugging
- DEBUG: Detailed information for debugging
- INFO: Informational messages
- WARN: Potentially problematic situations
- ERROR: Errors that allow the application to continue
- FATAL: Severe errors that prevent the application from functioning
- DEBUG: Detailed information about the Lambda system
- INFO: General information about the Lambda system
- WARN: Warnings about the Lambda system
This project is licensed under the MIT License - see the LICENSE file for details.