Amazon CloudFront
Developer Guide (API Version 2016-09-29)

CloudWatch Metrics and CloudWatch Logs for Lambda Functions

You can use CloudWatch metrics to monitor, in real time, the CloudFront requests that trigger Lambda functions. You can also use CloudWatch Logs to get aggregate data. There's no additional charge for metrics or logs.

CloudWatch Metrics

When you create a trigger for a CloudFront event, Lambda begins to send metrics to CloudWatch automatically. Metrics are available for all Lambda regions. The name of each metric is /aws/lambda/us-east-1.function-name, where function-name is the name that you gave to the function when you created it. CloudWatch sends metrics to the region that's closest to the location where the function is executed.

For more information about CloudWatch metrics, see the Amazon CloudWatch User Guide.

CloudWatch Logs

When you create a trigger, Lambda automatically starts to send data to CloudWatch Logs about the CloudFront requests that trigger Lambda functions. You use CloudWatch Logs tools to access the logs.

Lambda creates CloudWatch Logs log streams in the CloudWatch Logs regions closest to the locations where the function is executed. The log stream name is formatted as: /aws/lambda/us-east-1.function-name, where function-name is the name that you gave to the function when you created it.

Note

Lambda@Edge throttles logs based on the request volume and the size of logs.

To learn more about how to use CloudWatch Logs with Lambda functions, see the following:

  • For information about the permissions required to send data to CloudWatch Logs, see Setting IAM Permissions and Roles for Lambda@Edge in the IAM User Guide.

  • For information about adding logging to a Lambda function, see Logging (Node.js) in the AWS Lambda Developer Guide.

  • For information about CloudWatch Logs limits, see Limits in the Amazon CloudWatch Logs User Guide.