AWS Lambda introduces new controls to make it easier to search, filter, and aggregate Lambda function logs

Posted on: Jul 3, 2024

AWS Lambda announces advanced logging controls that enable you to natively capture logs in JSON structured format, adjust log levels, and select the Amazon CloudWatch log group for your Lambda functions.

You can now capture your Lambda logs in JSON structured format without having to bring your own logging libraries. JSON format allows logs to be structured as a series of key-value pairs, enabling you to quickly search, filter, and analyze your function logs. You can also control the log level (e.g. ERROR, DEBUG, INFO, etc.) of your Lambda logs without making any code changes. This enables you to choose the desired logging granularity level for your function, eliminating the need to sift through large volumes of logs while debugging and troubleshooting critical errors. Lastly, you can choose the CloudWatch log group to which Lambda sends your logs. This allows you to easily aggregate logs from multiple functions within an application in one place, and apply security, governance, and retention policies at the application level, rather than applying them individually to every function.

To get started, you can specify advanced logging controls for your Lambda functions using Lambda API, Lambda console, AWS CLI, AWS Serverless Application Model (SAM), and AWS CloudFormation. To learn more, visit the launch blog post or Lambda Developer Guide.

Lambda advanced logging controls are now available in AWS GovCloud (US) Regions, at no additional cost. For more information, see the AWS Region table.