4

Where do you see the console.log() calls made inside of AWS Lambda functions? I looked at AWS Cloud Watch event log and didn't see them there. Is there a CLI way to see them?

2 Answers 2

2

console.log() should definitely end up in the CloudWatch logs for your function. You should be able to find the correct log group in the web console interface for your function under the Monitoring tab - Jump to Logs. Note that you will have a different log stream for each invocation of your function, and there may be a delay between logs being written and logs showing up in a stream, so be patient.

It's possible you do not have the IAM permissions to create log groups or write to log streams. Ashan has provided links on how to fix that.

Additionally, you can use the awslogs tool to list groups/streams, as well as to download or tail groups/streams:

  • To list available groups: awslogs groups
  • To list available streams in group app/foo: awslogs streams app/foo
  • To "tail -f" all streams from a log group app/foo: awslogs get app/foo ALL --watch
Sign up to request clarification or add additional context in comments.

3 Comments

What do you men by "console interface for your function"? Do you mean the web console lamba>functions>myFunction then the section Designer? There is an item "Amazon Cloudwatch Logs" but it isn't clear where I actually see the log calls.
If you go to lamba>functions>myFunction>Monitoring tab, you will see lots of graphs of your function invocations. There is a link labeled "Jump to Logs" on top of each one which will take you to the CloudWatch Logs group for your function.
> you will have a different log stream for each invocation this is inaccurate. You have one log stream per container instance
0

Make sure you the IAM role assigned to the AWS Lambda function has permission to write to CloudWatch Logs. For more information regarding the policy refer Using Identity-Based Policies (IAM Policies)for CloudWatch Logs.

In addition, you should be able to view the CloudWatch log group by clicking on the CloudWatch Logs under Add Triggers in Lambda Console.

enter image description here

1 Comment

When I add CloudWatch Logs, then configure to add a trigger from my lambda function I get the warning: "The log group provided is reserved for the function logs of the destination function. (Service: AWSLogs; Status Code: 400; Error Code: InvalidParameterException; Request ID:1rfq4315-dfeq5"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.