Support

Sources

Netlify Log Drains

Export your logs from Netlify using Streamfold.

The Netlify source supports ingesting logs from your Netlify site using the Netlify Log Drains integration. At the moment you can export logs for site traffic, function output and build deployments. Netlify log drains are supported on Enterprise Netlify plans only.


Overview

Adding a Netlify source to your Streamfold topology allows you to ingest Netlify logs. Incoming logs will be converted to events and delivered to any connected streams.

This source contains special handling for Netlify log traffic. For example, function log output is split on newline characters and represented in Streamfold as individual events. This makes it easier to filter and transform log lines.

Configuration

In Streamfold, add a new Netlify source and give it a custom name. Hit save to add the source.

Navigate to your Netlify site within Netlify and find the Log Drains configuration under the Logs section.

You should know!

Log drains are only supported on Enterprise Netlify plans.

Follow the configuration instructions for adding a General HTTP log drain and enter the following configuration settings:

  • Log types: Select all types you are interested in, see below for handling traffic types in Streamfold.
  • Traffic log filtering: With Streamfold you can hash or mask PII, so we recommend leaving it unchecked.
  • Full URL: https://ingress.streamfold.com/streamfold/netlify (see below for adding parameters)
  • Authorization header: Copy and paste your Streamfold Ingress token.
  • Log drain format: NDJSON

Hit Save to test and enable the log drain.

You can always return to the in-app instructions by navigating to the Settings page under your Netlify source in Streamfold.

URL Parameters

If you are connecting log drains from multiple Netlify sites to Streamfold, you can add fields to identify which site a log event is from. Netlify will add the UUID of the site to the log event, but you may want to include the name of the site as well. To embed additional fields on all log events, add them as URL parameters when setting the URL for the log drain configuration.

For example, to add the fields: site_name=acme-www and env=production to all log events, use the Full URL:

https://ingress.streamfold.com/streamfold/netlify?site_name=acme-www&env=production

Traffic types

Netlify log drains support multiple log sources within Netlify. When you configure the log drain in Netlify you select which log types you would like to export. However, you also have full control in Streamfold to filter, transform and route individual log types.

Traffic logs

Netlify traffic logs expose the request and response parameters for every request served by the Netlify CDN for your site. Use them to identify how active your site is, where the source of your traffic comes from and which pages are the most active.

You can select Netlify traffic logs with the following filter:

  • log_type == traffic

Function logs

Netlify function logs include the output of any Netlify Functions executed as part of your site. If your function logs multiple lines of output, each line is emitted to Streamfold as a separate event. Function logs are helpful for debugging function execution and tracking performance.

Every Netlify Function execution will include the follow log line representing the AWS Lambda execution status:

REPORT RequestId: e2be222d-9983-471f-968e-0234c7936fbb	Duration: 1.47 ms	Billed Duration: 2 ms	Memory Size: 1024 MB	Max Memory Used: 16 MB

You can select Netlify function logs with the following filters:

  • log_type == functions
  • function_type == standard

Edge function logs

Netlify edge function logs include the output of any Netlify Edge Functions executed as part of a request. Edge function logs are useful for debugging edge function execution and performance. Each newline of output is emitted to Streamfold as a separate event.

You can select Netlify edge function logs with the following filters:

  • log_type == functions
  • function_type == edge

Deploy logs

Netlify deploy logs include the output from any site deployment. They can be useful for debugging site deploys or archiving past deployment status.

You can select Netlify deploy logs with the following filters:

  • log_type == deploys

Delivering as OpenTelemetry

If you connect your Netlify log drains source to an OpenTelemetry destination, such as Honeycomb, your events will be automatically converted to OpenTelemetry format. See the docs for how this conversion is performed.

It can be useful to convert Netlify's field names to their OpenTelemetry semantic conventions recommended versions. This Bloglang Code example demonstrates how to remap Netlify's log fields to match the semantic conventions. Drop it into your stream before delivering it to your OpenTelemetry destination.

# Map fields to known OTel Semantic HTTP fields
map otel_map_semantic {
  root = match {
    this.string() == "site_name" => "service.name",
    this.string() == "method" => "http.request.method",
    this.string() == "status_code" => "http.response.status_code",
    this.string() == "request_size" => "http.request.size",
    this.string() == "response_size" => "http.response.size",
    this.string() == "user_agent" => "user_agent.original",
    _ => this,
  }
}

root = this.map_each_key(key -> key.apply("otel_map_semantic"))

# Set url.scheme based on url prefix
root."url.scheme" = if root.url.has_prefix("https://") { "https" } else { "http" }

This assumes you are adding a site_name= parameter to the integration URL that identifies your site name.

Next steps

Now that you've connected your Netlify log drains to Streamfold, check out some guides for how to work with data in Streamfold:

  • Working with PII data: Securely work with PII data from Netlify to drive better analytics
  • Working with Logs: Extract additional value from Netlify log fields by matching on text or parsing enclosed JSON strings
Previous
HTTP Event Collector