# Engineering

October 18, 2022

Get Deep Visibility into CloudFront Logs with Axiom

AWS CloudFront is a globally distributed network offered by Amazon Web Services, which securely transfers content, such as software, SDKs, and videos, to clients with high transfer speed.

To ensure you run workloads properly, organizations need deep visibility into the health and performance of their CloudFront workloads at different layers, including the CloudFront origin domain and path. Axiom's CloudFront integration collects key metrics and logs from each layer to help you avoid bottlenecks and run your CloudFront workloads efficiently. Axiom provides you with advanced queries through APL to help you stay on top of critical changes in your CloudFront distribution workloads.

In this post, we'll highlight how Axiom CloudFront integration can help you:

  • Monitor the state of your CloudFront distribution
  • Run queries to get deep insights on your CloudFront distribution
  • Inspect event properties from CloudFront distribution


Configure CloudFront to send logs to Axiom

A CloudFront log configuration specifies the source and destination of your logs and the field they contain. To create and send logs from CloudFront to Axiom, we built an easy-to-use AWS CloudFormation template that lets you spin up an AWS Bucket and a Lambda to send logs from your CloudFront to Axiom.

Cloud formation

  • Acknowledge your stack and click on Create Stack.

  • I'll use S3 as my CloudFront origin domain in this tutorial. You can also use a Mediastore container or an Elastic Load Balancing endpoint as your origin domain. Back in your S3 bucket, deploy your static or dynamic website.

CloudFront dynamic content

Create CloudFront Distribution

  • Create your CloudFront distribution, and select the origin domain you configured earlier, which is the S3 bucket. Your origin domain can also be your Load Balancer or Mediastore.

  • In the dropdown menu under origin access, click on Origin access identities and select the existing origin access identity for your CloudFront S3 bucket.

CloudFront Distribution

  • In the Settings Pane, enable standard logging to be delivered to your S3 bucket.

CloudFront Distribution

  • Click on Create distribution. Once your distribution is created and deployed, copy your distribution domain name and paste it into your browser. You will see your CloudFront logs in your Axiom dataset instantly.

View and Analyze CloudFront Logs

Back in your Axiom UI you’ll see your CloudFront real-time logs. In the Datasets pane, you can view, filter, and analyze your logs to better understand your CloudFront distribution performance and gain insights from your data.

CloudFront logs

Stream CloudFront logs

Process and inspect all events from your CloudFront distribution and watch as each event is ingested live in your dataset. Get a detailed overview of your event properties to see your response_result_type, request_protocol, host, method and port

stream cloudfront logs

Get deep insights using APL

You can enable advanced monitoring on your CloudFront distribution using APL. APL lets you visualize your CloudFront logs with custom dashboards, run powerful queries and directly compare any query to an hour, day, week, or custom period.

By visualizing your logs using APL, you can track high-level CloudFront utilization, watch out for sudden changes, view your total distribution processes, ensure that your CloudFront distribution has sufficient capacity, and efficiently troubleshoot any issues that arise faster.

Below are advanced queries ran on my CloudFront distribution using APL:

Successful Requests

| where status < 400
| summarize count() by bin_auto(_time), status

Successful Request

Bad Requests

| where status >= 400 and status <500
| summarize count() by bin_auto(_time), status, x_edge_detailed_result_type

Bad Requests

Requests by method

| where isnotnull( method )
| summarize count=count() by bin_auto(_time), method

Requests by Method

Popular Edge Region

| where isnotnull( location )
| summarize count=count() by bin_auto(_time), ["Edge Region"]=['location']
| limit 20

Popular Edge Regions

Function Request

| where isnotnull ( status)
| summarize count=count() by bin_auto(_time), status
| limit 20

Function Requests

Total logs by Request Protocol

| where isnotnull ( request_protocol)
| summarize count=count() by bin_auto(_time), request_protocol

Total requests by protocol

The CloudFront Dashboard

Easily detect which functions, protocols, and regions are experiencing issues or slowdowns, and see an overview of the successful and bad requests coming into your distribution.

The CloudFront dashboard is where you see a detailed breakdown of all your distribution logs and understand which data to investigate whenever any issue arises.

CloudFront dashboard

Try it out today

Head over to our GitHub repository today to install the Axiom CloudFront integration and get advanced observability for all your CloudFront distributions.

Join us in changing how developers think about data