|
| 1 | +--- |
| 2 | +title: Vercel Drains |
| 3 | +sidebar_order: 75 |
| 4 | +description: Learn how to set up Vercel drains to send forward logs and traces data to Sentry. |
| 5 | +--- |
| 6 | + |
| 7 | +To set up a Drain in Vercel you'll need to create a new Drain in the Vercel settings. For more information on Vercel Drains, please see the [Vercel drain documentation](https://vercel.com/docs/drains). |
| 8 | + |
| 9 | +1. From the Vercel dashboard, go to **Team Settings > Drains** and click **Add Drain**. |
| 10 | +2. Choose a data type. Currently only Logs and Traces are supported. |
| 11 | + |
| 12 | +- [Logs](#log-drains) |
| 13 | +- [Traces](#trace-drains) |
| 14 | + |
| 15 | +## Log Drains |
| 16 | + |
| 17 | +<Alert> |
| 18 | + |
| 19 | +Vercel Log Drains support is currently in closed alpha. Please reach out to [[email protected]](mailto:[email protected]) if you have feedback or questions. Features in alpha are still in-progress and may have bugs. We recognize the irony. |
| 20 | + |
| 21 | +</Alert> |
| 22 | + |
| 23 | +After selecting the Logs data type, you'll need to configure the drain to send data to Sentry. |
| 24 | + |
| 25 | +1. 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. |
| 26 | +2. 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. |
| 27 | +3. Select which log sources to collect |
| 28 | + |
| 29 | +- **Functions**: Outputs log data from Vercel Functions like API Routes |
| 30 | +- **Edge Functions**: Outputs log data from Vercel Functions or Routing Middleware using Edge runtime |
| 31 | +- **Static Files**: Collects logs for static assets like HTML and CSS files |
| 32 | +- **Rewrites**: Collects log results for external [rewrites](https://vercel.com/docs/project-configuration#rewrites) to a different domain |
| 33 | +- **Builds**: Outputs log data from the Build Step |
| 34 | +- **Firewall**: Outputs log data from requests denied by [Vercel Firewall](https://vercel.com/docs/vercel-firewall) rules |
| 35 | + |
| 36 | +4. Select which environments to drain from. You can choose to drain from all environments or select specific ones. |
| 37 | +5. 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. |
| 38 | + |
| 39 | +```URL |
| 40 | +___VERCEL_LOG_DRAIN_URL___ |
| 41 | +``` |
| 42 | + |
| 43 | +6. 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**. |
| 44 | + |
| 45 | +``` |
| 46 | +x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___ |
| 47 | +``` |
| 48 | + |
| 49 | +7. To test that the log drain is working, you can send a test log to your drain by clicking the Test button. |
| 50 | + |
| 51 | +## Trace Drains |
| 52 | + |
| 53 | +After selecting the Traces data type, you'll need to configure the drain to send data to Sentry. |
| 54 | + |
| 55 | +1. 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. |
| 56 | +2. 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. |
| 57 | +3. 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)** > **OpenTelemetry (OTLP)** under the **OTLP Traces Endpoint** section. |
| 58 | + |
| 59 | +```URL |
| 60 | +___OTLP_TRACES_URL___ |
| 61 | +``` |
| 62 | + |
| 63 | +4. 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. |
| 64 | + |
| 65 | +``` |
| 66 | +x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___ |
| 67 | +``` |
| 68 | + |
| 69 | +5. To test that the trace drain is working, you can send a test trace to your drain by clicking the Test button. |
0 commit comments