Compute@Edge log streaming: New Relic Logs

Fastly's Real-Time Log Streaming feature for Compute@Edge services can send log files to New Relic Logs.

Prerequisites

Before adding New Relic Logs as a logging endpoint for Fastly Compute@Edge services, you will need to:

Adding New Relic Logs as a logging endpoint

Follow these instructions to add New Relic Logs as a logging endpoint:

  1. Review the information in our Setting Up Remote Log Streaming guide.

  2. Click the New Relic Logs Create endpoint button. The Create a New Relic Logs endpoint page appears.
  3. Fill out the Create a New Relic Logs endpoint fields as follows:
    • In the Name field, enter the name you specified in your Compute@Edge code. For example, in our Rust code example, the name is my_endpoint_name.
    • In the License key / Insert key field, enter your New Relic license key or Insert API key.
  4. Click the Create button to create the new logging endpoint.
  5. Click the Activate button to deploy your configuration changes.

Using New Relic Instant Observability's prebuilt Fastly dashboard

New Relic I/O is an open source ecosystem of a wide variety of community-contributed monitoring quickstarts. We worked with New Relic to develop a prebuilt dashboard that highlights key metrics. Because the code is open source, you can customize it.

New Relic Fastly Dashboard

Configure Your Log Messages

Data sent to New Relic Logs must be serialized as a JSON object. The JSON object should include the following fields:

  • timestamp: when the request occurred. The timestamp must be specified as millisecond or seconds since Epoch overrides the New Relic timestamp. If timestamp is not included, Fastly will generate a timestamp.
  • client_ip: the IP address of the client making the HTTP request.
  • url: the URL of the request.
  • resp_status: the HTTP status code of the request.
  • client_resp_header_size_write: the size of the response header.
  • client_resp_body_size_write: the size of the response body.
  • fastly_datacenter: the three-character identifying code of the FASTLY_POP in which the current instance is running.
  • time_elapsed: the time since the request started.
  • service_id: the identifier for the Fastly service that is processing the current request.

An example JSON object is shown below.

1
2
3
4
5
6
7
8
9
10
11
{
  "timestamp": 1661976797605,
  "client_ip": "127.0.0.1",
  "url": "https://curiously-selected-llama.edgecompute.app/",
  "resp_status": 200,
  "client_resp_header_size_write": 1234,
  "client_resp_body_size_write": 56789,
  "fastly_datacenter": "IAD",
  "time_elapsed": 237,
  "service_id": "<service id>"
}

While the prebuilt dashboard won't break if the JSON object doesn't include all of the expected fields, certain charts won't have data.

In addition to the expected fields, you can include fields of your choosing in the JSON object for your own purposes or to maintain backward compatibility with existing dashboards you've built.

Install the Fastly dashboard

Follow these instructions to install the Fastly dashboard quickstart:

  1. Select the Fastly dashboard quickstart from the New Relic marketplace or navigate directly to the Fastly dashboard page. The Fastly CDN page appears.
  2. Click the Install quickstart button. The Quickstart installation page appears.
  3. Click the Begin installation button. The Installation plan window appears.
  4. Click the Done button or the Skip this step link.
  5. Click the See your data button. The Fastly dashboard appears.
Back to Top