Analyze your AWS Lambda Logs with Cloudwatch Logs Insights

George Mao
4 min readJun 22, 2020

Cloudwatch Logs Insights is the most powerful, easiest way to produce actionable intelligence from your out of the box AWS Lambda Logs. I feel like most people overlook Cloudwatch Logs Insights when it comes time to analyze and review your Lambda performance. Let’s take a look at a few things you can do.

First, you’ll need to select a log group to analyze. I have a function called pcTester, so its logs are in the log group: /aws/lambda/pcTester.

Every Lambda function invocation remits a log entry as the very last line, with the keyword REPORT. The REPORT line contains many extremely useful bits of information, including the RequestId, Duration, Billed Duration, Memory Size, Max Memory Used, and the Init Duration. These are all standard fields and will be present on every invoke. Here’s an example from my logs:

REPORT RequestId: 8e7aee14-182b-4e48-a1ce-5c93f1f8bc2b 
Duration: 105.41 ms
Billed Duration: 200 ms
Memory Size: 128 MB
Max Memory Used: 65 MB
Init Duration: 113.80 ms

A few observations

This log tells me that it took 105.41 ms to run my function, but I was billed for 200 ms — that’s because Lambda bills in 100 ms intervals, rounded up. I can also see that my function was configured at 128 MB of memory, but only used 65

--

--

George Mao

Distinguished Engineer @ Capital One leading all things Serverless | Ex -AWS WW Serverless Tech Lead.