How to Set Up Vercel Logging with Log Drains
Stream your Vercel logs into GraphJSON with a one-click log drain integration and turn them into dashboards, alerts and SQL queries.
Vercel's built-in log viewer is fine for a quick look at a failing deploy. But the logs there are short-lived, hard to aggregate, and impossible to alert on. If you've ever found yourself scrolling through function invocations trying to spot a pattern, what you actually want is a log drain - Vercel's mechanism for streaming every log line to an external endpoint as structured JSON.
GraphJSON has a one-click Vercel integration that sets this up for you.
Step 1: Connect your Vercel account#
From the Vercel integration page in your GraphJSON dashboard, connect your Vercel account via OAuth. GraphJSON lists your projects (and your team's projects, if you have any) alongside any log drains you've already created.
Step 2: Create a log drain#
Pick a project and a GraphJSON collection, and create the drain. From that moment, your Vercel logs - build output, serverless function invocations, edge requests, errors - stream into GraphJSON as JSON events. There's no agent to install and no code to deploy; it's Vercel's native plumbing.
Step 3: Actually use your logs#
Once log lines are JSON events in ClickHouse, the usual GraphJSON toolbox applies:
- Graph error rates over time - filter to error-level logs and watch the trend instead of discovering outages from your users.
- Set alerts - get pinged when error volume spikes or a specific function starts failing.
- Query with SQL - ClickHouse SQL over your logs in a notebook: top failing routes, slowest functions, traffic by path. No more scrolling.
- Keep history - your logs live in your collection with the retention policy you choose, not a short platform window.
A quick example of the kind of question that becomes trivial - most-hit paths:
SELECT JSONExtractString(json, 'path') AS path, count() AS requests
FROM vercel
GROUP BY path
ORDER BY requests DESC
LIMIT 20
Logs tell you what broke; events tell you what happened#
Infrastructure logs and product analytics answer different questions. The log drain covers "why did this function fail at 3am"; custom events cover "did the new onboarding flow convert". For the second, log events from your API routes - we walk through it in How to Add Analytics to Your Next.js App. The two streams live side by side in GraphJSON, one dashboard away from each other.

Written by JR
Founder and builder of GraphJSON.