Vercel Drains
Learn how to set up Vercel drains to forward logs and traces data to Sentry.
Vercel Drains let you forward traces and logs from applications running on Vercel to Sentry. For more information on Vercel Drains, see the Vercel drain documentation. Currently only Logs and Traces are supported.
- Logs: Runtime, build, and static logs from your deployments
- Traces: Distributed tracing data collected via OpenTelemetry (OTLP) from your applications
Before you begin, ensure you have:
- A Vercel pro or higher plan and project that you want to monitor
- A Sentry project you want to send data to
If you've installed the Sentry Vercel Integration, you can set up a drain via the integration.
If you haven't installed the integration, you can follow the instructions in the Sentry Vercel Integration documentation to install the integration.
Then you can add a Drain from your Vercel team's Integrations tab.
- From the Vercel dashboard, view the integrations list by clicking the Integrations tab.
- Select the Sentry integration from the integrations list to view the integration settings.
- Click Manage and select your installed product
- Under Drains, click Add Drain to create a new drain.
- Configure which project you would like to send data from and click Create Drain to create the drain.
Automatic Log Drain Setup for Vercel is only available with the Native Integration, which requires you to create a new Sentry Account when you install the integration. An existing Sentry account cannot be linked with the native integration at this moment. For those using an existing Sentry account, you can follow the instructions in the Manual Drain Setup section to set up a drain manually.
To set up a Drain in Vercel manually, you'll need to create a new Drain in the Vercel settings.
- From the Vercel dashboard, go to Team Settings > Drains and click Add Drain.
- Choose a data type.
After selecting the Logs data type, you'll need to configure the drain to send data to Sentry.
Provide a name for your drain and select which projects should send data to your endpoint. You can choose all projects or select specific ones.
Configure the sampling rate to control the volume of data sent to your drain. We recommend sampling 100% of the data to ensure you get all the data you need.
Select which log sources to collect. See Log Source Details for more information.
Select which environments to drain from. You can choose to drain from all environments or select specific ones.
Under the custom endpoint tab add the Sentry Vercel Log Drain Endpoint in the URL field. You can find the endpoint in your Sentry Project Settings under Client Keys (DSN) > Vercel. You can select either JSON or NDJSON encoding.
___VERCEL_LOG_DRAIN_URL___
- Click the Custom Headers toggle and add the Sentry Authentication Header. You'll also find the header value in your Sentry Project Settings under Client Keys (DSN) > Vercel.
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
- To test that the log drain is working, you can send a test log to your drain by clicking the Test button.
After selecting the Traces data type, you'll need to configure the drain to send data to Sentry.
- Provide a name for your drain and select which projects should send data to your endpoint. You can choose all projects or select specific ones.
- Configure the sampling rate to control the volume of data sent to your drain. We recommend sampling 100% of the data to ensure you get all the data you need.
- Under the custom endpoint tab add the Sentry Vercel Trace Drain Endpoint in the URL field. You can find the endpoint in your Sentry Project Settings under Client Keys (DSN) > OpenTelemetry (OTLP) under the OTLP Traces Endpoint section.
___OTLP_TRACES_URL___
- Click the Custom Headers toggle and add the Sentry Authentication Header. You'll also find the header value in your Sentry Project Settings under Client Keys (DSN) > OpenTelemetry (OTLP) under the OTLP Traces Endpoint Headers section.
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
- To test that the trace drain is working, you can send a test trace to your drain by clicking the Test button.
Sending metrics via Vercel Metric Drains (Speed Insights, Web Analytics) are currently not currently supported. If you're interested this support for this please reach out on GitHub or or email us at feedback-metrics@sentry.io.
Vercel Log Drains support the following log sources:
- Functions: Outputs log data from Vercel Functions like API Routes
- Edge Functions: Outputs log data from Vercel Functions or Routing Middleware using Edge runtime
- Static Files: Collects logs for static assets like HTML and CSS files
- Rewrites: Collects log results for external rewrites to a different domain
- Builds: Outputs log data from the Build Step
- Firewall: Outputs log data from requests denied by Vercel Firewall rules
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").