Skip to content

How can I view my AWS Lambda logs in CloudWatch?

0

How can I view my AWS Lambda logs in CloudWatch?

I'm new to AWS and recently created a Lambda function. I want to view the logs to understand what’s happening during execution.

Can someone explain how I can access my Lambda logs in CloudWatch? Step-by-step guidance would be helpful.

Thank you in advance!

Tags to add:

AWS Lambda

Amazon CloudWatch

Logging

1 Answer
1
Accepted Answer

You can view your AWS Lambda logs in CloudWatch through several methods:

Using the Lambda Console:

  1. Open the Lambda console
  2. Navigate to your function
  3. Check the "Monitor" tab
  4. View execution results in the logs section
  5. When testing your function, you can also see logs in the "Details" section

Using the CloudWatch Console:

  1. Open the CloudWatch console
  2. Go to the "Log groups" page
  3. Find and select the log group for your function (typically named "/aws/lambda/your-function-name")
  4. Choose a log stream to view detailed logs (each stream corresponds to an instance of your function)

Using the AWS CLI: You can retrieve logs using the AWS Command Line Interface with the --log-type Tail command option and decode the logs using the base64 utility.

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. Your function's logs are stored in a log group named "/aws/lambda/function-name".

Note that there might be a delay of 5-10 minutes before logs appear in CloudWatch after function execution.
Sources
Viewing CloudWatch logs for Lambda functions - AWS Lambda
Log and monitor Go Lambda functions - AWS Lambda
Log and monitor Node.js Lambda functions - AWS Lambda
Sending Lambda function logs to CloudWatch Logs - AWS Lambda

answered 9 months ago
EXPERT
reviewed 9 months 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.