Vercel Log Drains

Vercel’s log drains feature allows you to send logs produced in Vercel to a third-party system, such as Dash0.

The Dash0 Vercel Log Drain integration lets you collect all your log records from Vercel build steps, runtimes, edge network traffic, etc., in one location.

Dash0 Settings

To configure and use Vercel's Log Drains capability, you must provide the Dash0 endpoint to send data to and the Dash0 Authorization token.

If you are already using Dash0, you can find it in the onboarding section. If you are just looking for this data, you can find it in the manage section of your organization:

Screenshot Manage Authorization Tokens

Screenshot Manage Authorization Tokens

Screenshot Manage Endpoints

Screenshot Manage Endpoints

Configure Vercel Log Drains

The API Endpoint and Authorization token needs to be specified in Vercel's log drain settings, which can be found under:

Team Settings -> Log Drains (in the left sidebar)

Screenshot Vercel Settings - Log Drains

Screenshot Vercel Settings - Log Drains

You can choose if you want to forward logs for all projects or only specific projects.

Select the sources, such as Static, Edge, Function, Build, Firewall, etc., for which you want to export logs and choose JSON as the delivery format.

Now specify the environments for which you want to forward logs and select the desired sampling rate. Vercel's documentation provides more details about the sampling rate.

Screenshot Vercel Log Drains - Delivery Format

Screenshot Vercel Log Drains - Delivery Format

Fill in the API Endpoint URL from Dash0's settings to the Endpoint field.

Authorization when sending data to Dash0 is based on a custom header, so enable "Custom Headers."

Copy x-vercel-verify to the Header Key and copy the value after the colon into the Header value field. Now, you can add a second header using the "Add" button.

Specify Authorization as the Header Key and add Bearer as a prefix to your Authorization token starting with auth_. The value field will contain a value of the format: Bearer auth_XXXXXX

Screenshot Vercel Log Drains Settings Custom Headers

Screenshot Vercel Log Drains Settings - Custom Headers

You can Test the Log Drain configuration using the Test button and finalize the configuration using the Add Log Drain Button.

Vercel Log Drain Attributes

Vercel logs will automatically contain an attribute vercel.projectId on all log records.

The processing of log records in Dash0 can be adjusted using the following HTTP headers:

X-Dash0-Dataset

If you add the X-Dash0-Dataset header to the log drain configuration, the header value will be converted to the resource attribute dash0.dataset.

X-Dash0-Disable-Open-Telemetry-Semantic-Conventions

If the header X-Dash0-Disable-Open-Telemetry-Semantic-Conventions is defined with the value 1, no conversion to OpenTelemetry semantic conventions will be performed.
Instead, the log attributes will be converted exclusively to attribute names with the prefix vercel.

Last updated: August 28, 2024