Vercel log drain
This feature is in Early Access
LaunchDarkly’s observability features are publicly available in early access. Enable observability in the billing page.
They currently require the LaunchDarkly observability SDKs and the JavaScript, React Web, or Vue SDK.
If you are interested in participating in the Early Access Program for our upcoming observability plugins for server-side SDKs, sign up here.
Overview
This topic explains how to send logs from Vercel to LaunchDarkly’s observability features using a Vercel log drain.
If you deploy your applications on Vercel, you can configure a log drain to automatically forward your server-side logs to LaunchDarkly. This includes build logs, serverless function logs, edge function logs, and static access logs. Once configured, these logs appear in the Logs page of the LaunchDarkly user interface.
Prerequisites
Before you configure the Vercel log drain, you must:
- Have a Vercel account with at least one project
- Have LaunchDarkly observability enabled for your project
- Know your LaunchDarkly client-side ID
To find your client-side ID:
- In the LaunchDarkly UI, click the project dropdown to open the project menu.
- Select Project settings.
- Click Environments.
- Find the environment you want to use and copy the Client-side ID value.
Configure the Vercel log drain
You can configure the log drain directly in the Vercel dashboard.
To configure the Vercel log drain:
- In Vercel, navigate to your team or account Settings.
- Click Log Drains in the sidebar.
- Click Add Log Drain.
- Select the Projects and Environments you want to collect logs from.
- Select Sources to specify which types of logs to send. You can choose from:
- Build logs
- Edge function logs
- Lambda (serverless function) logs
- Static access logs
- For Delivery format, select NDJSON.
- For Endpoint, enter
https://pub.observability.app.launchdarkly.com/vercel/v1/logs. - Click Add Custom Headers.
- Add a header with the name
x-highlight-projectand set the value to your LaunchDarkly client-side ID. - Click Verify to test the connection.
- Click Create Log Drain to save the configuration.
Verify that logs are being received
After you configure the log drain, Vercel begins forwarding logs to LaunchDarkly.
To verify that your logs are being received:
- In the LaunchDarkly UI, expand Observe in the left navigation.
- Click Logs.
- Look for logs with
source:vercelor from your Vercel-deployed services.
It may take a few minutes for logs to appear after you first configure the log drain.
Search attributes
Logs from Vercel include the following attributes that you can use when searching:
To learn more about searching for logs, read Search specification.
Filtering logs
You can configure ingestion filters to control which logs from Vercel are stored in LaunchDarkly. This is useful for excluding noisy logs or limiting ingestion to stay within your observability quotas.
To learn more, read Filters.