Compute@Edge log streaming: Datadog

Fastly's Real-Time Log Streaming feature for Compute@Edge services can be configured to send logs in a format readable by Datadog. Datadog is a cloud-based monitoring and analytics solution that allows you to see inside applications within your stack and aggregate the results.


Fastly does not provide direct support for third-party services. Read Fastly's Terms of Service for more information.


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

  • Register for a Datadog account. You can sign up for a Datadog account on their site. A free plan exists that has some restrictions or you can upgrade for more features. Where you register your Datadog setup, either in the United States (US) or the European Union (EU), will affect which commands you use during logging endpoint setup at Fastly.

  • Get your Datadog API key from your settings page on Datadog. In the Datadog interface, navigate to "Integrations -> APIs" where you'll be able to create or retrieve an API key.

    The Token Page

    This example displays the key decafbaddeadbeef. Your API key will be different. Make a note of this key somewhere.

Adding Datadog as a logging endpoint

After you've created a Datadog account and noted your Datadog API key, follow the steps below to add Datadog as a logging endpoint for Fastly Compute@Edge services.

  1. Review the information in our guide to setting up remote log streaming for Compute@Edge. Additionally, our developer documentation provides more information about logging with Compute@Edge code written in Rust, AssemblyScript, and JavaScript.
  2. Click the Datadog Create endpoint button. The Create a Datadog endpoint page appears.
  3. Fill out the Create a Datadog endpoint fields as follows:
    • In the Name field, enter the endpoint name you specified in your Compute@Edge code. For example, in our Rust code example, the name is my_endpoint_name.
    • From the Region menu, select the region to stream logs to.
    • In the API key field, enter the API key of your Datadog account.
  4. Click the Create button to create the new logging endpoint.
  5. Click the Activate button to deploy your configuration changes.

Data sent to Datadog must be serialized in a way conforming to Datadog's expectations.

If your logs are not formatted properly, attempts at processing your logs by your Datadog endpoint may fail. Here's an example format string for sending data to Datadog:

2 "ddsource": "fastly",
3 "ddtags": "env:production,version:1.0",
4 "hostname": "hostname",
5 "message": "2019-11-19T14:37:58,995 INFO Hello World",
6 "service": "service_id"

You can follow the general JSON structure above regardless of the chosen language for your Compute@Edge service and include the specific details inside designated fields, such as message. The ddsource field is required. Nested JSON objects are supported. Refer to the Datadog documentation for other available options for Datadog log messages. The emitted logs must be formatted as valid JSON.

Logs should begin appearing in your Datadog account a few seconds after you've created the endpoint and deployed your service changes. These logs can then be accessed via the Datadog Log Explorer on your Datadog account.

Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support.