Where can I find logs for a Lambda function?

0

Where can I find logs for a Lambda function? I just created a new Lambda function and enabled CloudWatch logs in the console. But I’m not sure how to actually view the logs — the interface is a little confusing.

Where exactly in CloudWatch should I look to see logs for a specific Lambda function?

1 Answer
1
Accepted Answer

You can view logs for your Lambda function in several ways:

  1. Using the Lambda console:
  • Go to the Lambda console
  • Select your function
  • Choose the "Monitor" tab
  • View the execution results in the "Logs" section
  • You can also check the "Details" section when using the console test feature
  1. Using the CloudWatch console:
  • Open the CloudWatch console
  • Navigate to the "Log groups" page
  • Find and select the log group for your Lambda function (it will be named "/aws/lambda/your-function-name")
  • Click on a log stream to see the detailed logs
  1. Using the AWS Command Line Interface (CLI):
  • You can retrieve logs using the AWS CLI with the --log-type command option
  • The logs can be decoded using base64

By default, Lambda automatically captures logs for all function invocations and sends them to CloudWatch Logs, provided your function's execution role has the necessary permissions. Each log stream corresponds to an instance of your function. The Lambda runtime automatically logs the start and end of each function invocation, including details like request ID, duration, memory usage, and more.

You can also use CloudWatch Logs Live Tail to view and filter logs in real time through the Lambda console.
Sources
What is the easiest way to view logs for a Lambda function in AWS CloudWatch? | AWS re:Post
Sending Lambda function logs to CloudWatch Logs - AWS Lambda
Viewing CloudWatch logs for Lambda functions - AWS Lambda

answered 14 days ago
EXPERT
reviewed 13 days ago
AWS
EXPERT
reviewed 13 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions