Skip to content

A Serverless Framework plugin (compatible with version 3.40.0 and earlier) to configure AWS Lambda logging options.

License

Notifications You must be signed in to change notification settings

vavasilva/serverless-configure-lambda-logs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Configure Lambda Logs

A Serverless Framework plugin (compatible with version 3.40.0 and earlier) to configure AWS Lambda logging options.

Installation

# NPM
npm install --save-dev serverless-configure-lambda-logs

# Or using the Serverless Framework plugin command
serverless plugin install -n serverless-configure-lambda-logs

Local Development

If you want to develop or test this plugin locally:

  1. Clone this repository
  2. Install it locally in your project:
# In your Serverless project directory
npm install --save-dev /path/to/serverless-configure-lambda-logs

Usage

Add the plugin to your serverless.yml file:

plugins:
  - serverless-configure-lambda-logs

Global Configuration

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

Per-Function Configuration

Configure log options individually for each function:

functions:
  hello:
    handler: handler.hello
    logs:
      format: json
      applicationLevel: DEBUG
      systemLevel: DEBUG
      logGroup: /custom/log/group/path

Features

  • 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

Log Levels

Application Log Levels

  • 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

System Log Levels

  • DEBUG: Detailed information about the Lambda system
  • INFO: General information about the Lambda system
  • WARN: Warnings about the Lambda system

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Serverless Framework plugin (compatible with version 3.40.0 and earlier) to configure AWS Lambda logging options.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published