Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you look at console.log output of the amazon lambda function

When you do a

console.log('Loading function'); 

in an amazon lambda function, where does that go?

My setup api gateway lambda function nodejs6.10 curl https://n2tredacted.execute-api.us-east-1.amazonaws.com/prod/redactedFunc

like image 476
american-ninja-warrior Avatar asked Dec 16 '17 15:12

american-ninja-warrior


People also ask

How do I view Lambda console logs?

To view logs using the Lambda consoleOpen the Functions page of the Lambda console. Choose a function. Choose Monitor. Choose View logs in CloudWatch.

Where do AWS Lambda logs go?

Lambda automatically captures runtime logs and streams them to Amazon CloudWatch. This log stream contains the logs that your function code and extensions generate, and also the logs that Lambda generates as part of the function invocation.

Where is the Lambda console?

After creating your Lambda function, view it in the AWS Management Console. From the top of your Management console, click Services and type in "Lambda". Select "Functions" from the left sidebar and then click on ambSupplyChainConnector.


1 Answers

AWS Lambda logs are written to CloudWatch Logs. Here's how to access them:

  1. select your Lambda function in the AWS console
  2. click the Monitoring tab
  3. choose View logs in CloudWatch

If you prefer to retrieve CloudWatch Logs outside of the AWS Console, then there are numerous CLI options:

  • awscli: aws logs get-log-events
  • github: jorgebastida/awslogs
  • github: TylerBrock/saw
  • serverless: sls logs (if using serverless)
  • samcli: sam logs (if using SAM)
like image 65
jarmod Avatar answered Sep 25 '22 15:09

jarmod