Log Drains Reference

Log Drains forward logs from your deployments to external endpoints for storage and analysis. To enable Log Drains, you must provide an endpoint URL to send the logs to. This URL can be a custom endpoint of yours or one provided by a third-party provider like Datadog, New Relic, or other observability services.

Vercel sends logs to endpoint URLs over HTTPS every time your deployments generate logs. Multiple logs may be batched into a single request when possible to optimize delivery performance.

The following table describes the possible fields that are sent via Log Drains:

NameTypeRequiredDescriptionExample
idstringYesUnique identifier for the log entry1573817187330377061717300000
deploymentIdstringYesIdentifier for the Vercel deploymentdpl_233NRGRjVZX1caZrXWtz5g1TAksD
sourceenumYesOrigin of the logbuild, edge, lambda, static, external, or firewall
hoststringYesDeployment unique URL hostname*.vercel.app
timestampnumberYesUnix timestamp when the log was generated1573817187330
projectIdstringYesIdentifier for the Vercel projectgdufoJxB6b9b1fEqr1jUtFkyavUU
levelenumYesLog severity levelinfo, warning, error, or fatal
messagestringNoLog message content (may be truncated if over 256 KB)Adding customer to database...
buildIdstringNoIdentifier for the Vercel buildbld_cotnkcr76 (only present on build logs)
entrypointstringNoEntrypoint for the requestapi/index.js
destinationstringNoOrigin of the external contenthttps://vitals.vercel-insights.com/v1 (only on external logs)
pathstringNoFunction or dynamic path of the request/dynamic/[route].json
typestringNoLog output typecommand, stdout, stderr, exit, deployment-state, delimiter, middleware, middleware-invocation, edge-function-invocation, metric, report, fatal
statusCodenumberNoHTTP status code of the request200 (-1 means no response returned and the lambda crashed)
requestIdstringNoIdentifier of the request643af4e3-975a-4cc7-9e7a-1eda11539d90
environmentenumNoDeployment environmentproduction or preview
branchstringNoGit branch namemain
ja3DigeststringNoJA3 fingerprint digest769c83e5b...
ja4DigeststringNoJA4 fingerprint digestt13d1516h2...
edgeTypeenumNoType of edge runtimeedge-function or middleware
projectNamestringNoName of the Vercel projectmy-app
executionRegionstringNoRegion where the request is executedsfo1
traceIdstringNoTrace identifier for distributed tracing1b02cd14bb8642fd092bc23f54c7ffcd
spanIdstringNoSpan identifier for distributed tracingf24e8631bd11faa7
trace.idstringNoTrace1b02cd14bb8642fd092bc23f54c7ffcd
span.idstringNoSpanf24e8631bd11faa7
proxyobjectNoContains information about proxy requestsSee proxy fields below
proxy.timestampnumberYes*Unix timestamp when the proxy request was made1573817250172
proxy.methodstringYes*HTTP method of the requestGET
proxy.hoststringYes*Hostname of the requesttest.vercel.app
proxy.pathstringYes*Request path with query parameters/dynamic/some-value.json?route=some-value
proxy.userAgentarrayYes*User agent strings of the request["Mozilla/5.0..."]
proxy.refererstringYes*Referer of the request*.vercel.app
proxy.regionstringYes*Region where the request is processedsfo1
proxy.statusCodenumberNoHTTP status code of the proxy request200 (-1 means revalidation occurred in the background)
proxy.clientIpstringNoClient IP address120.75.16.101
proxy.schemestringNoProtocol of the requesthttps
proxy.responseByteSizenumberNoSize of the response in bytes1024
proxy.cacheIdstringNoOriginal request ID when request is served from cachepdx1::v8g4b-1744143786684-93dafbc0f70d
proxy.pathTypestringNoHow the request was served based on its path and project configurationfunc, prerender, background_func, edge, middleware, streaming_func, partial_prerender, external, static, not_found, unknown, api
proxy.pathTypeVariantstringNoVariant of the path typeapi
proxy.vercelIdstringNoVercel-specific identifiersfo1::abc123
proxy.vercelCacheenumNoCache status sent to the browserMISS, HIT, STALE, BYPASS, PRERENDER, REVALIDATED
proxy.lambdaRegionstringNoRegion where lambda function executedsfo1
proxy.wafActionenumNoAction taken by firewall ruleslog, challenge, deny, bypass, rate_limit
proxy.wafRuleIdstringNoID of the firewall rule that matchedrule_gAHz8jtSB1Gy

*Required when proxy object is present

Vercel supports the following formats for Log Drains. You can configure the format when configuring the Drain destination:

Vercel sends logs as JSON arrays containing log objects:

{ "id": "1573817187330377061717300000", "deploymentId": "dpl_233NRGRjVZX1caZrXWtz5g1TAksD", "source": "build", "host": "my-app-abc123.vercel.app", "timestamp": 1573817187330, "projectId": "gdufoJxB6b9b1fEqr1jUtFkyavUU", "level": "info", "message": "Build completed successfully", "buildId": "bld_cotnkcr76", "type": "stdout", "projectName": "my-app" }
{ "id": "1573817250283254651097202070", "deploymentId": "dpl_233NRGRjVZX1caZrXWtz5g1TAksD", "source": "lambda", "host": "my-app-abc123.vercel.app", "timestamp": 1573817250283, "projectId": "gdufoJxB6b9b1fEqr1jUtFkyavUU", "level": "info", "message": "API request processed", "entrypoint": "api/index.js", "requestId": "643af4e3-975a-4cc7-9e7a-1eda11539d90", "statusCode": 200, "path": "/api/users", "executionRegion": "sfo1", "environment": "production", "traceId": "1b02cd14bb8642fd092bc23f54c7ffcd", "spanId": "f24e8631bd11faa7", "trace.id": "1b02cd14bb8642fd092bc23f54c7ffcd", "span.id": "f24e8631bd11faa7", "proxy": { "timestamp": 1573817250172, "method": "GET", "host": "my-app.vercel.app", "path": "/api/users?page=1", "userAgent": ["Mozilla/5.0..."], "referer": "https://my-app.vercel.app", "region": "sfo1", "statusCode": 200, "clientIp": "120.75.16.101", "scheme": "https", "vercelCache": "MISS" } }

Vercel sends logs as newline-delimited JSON objects:

{"id": "1573817187330377061717300000","deploymentId": "dpl_233NRGRjVZX1caZrXWtz5g1TAksD","source": "build","host": "my-app-abc123.vercel.app","timestamp": 1573817187330,"projectId": "gdufoJxB6b9b1fEqr1jUtFkyavUU","level": "info","message": "Build completed successfully","buildId": "bld_cotnkcr76","type": "stdout","projectName": "my-app"}
{"id": "1573817250283254651097202070","deploymentId": "dpl_233NRGRjVZX1caZrXWtz5g1TAksD","source": "lambda","host": "my-app-abc123.vercel.app","timestamp": 1573817250283,"projectId": "gdufoJxB6b9b1fEqr1jUtFkyavUU","level": "info","message": "API request processed","entrypoint": "api/index.js","requestId": "643af4e3-975a-4cc7-9e7a-1eda11539d90","statusCode": 200,"path": "/api/users","executionRegion": "sfo1","environment": "production","traceId": "1b02cd14bb8642fd092bc23f54c7ffcd","spanId": "f24e8631bd11faa7","trace.id": "1b02cd14bb8642fd092bc23f54c7ffcd","span.id": "f24e8631bd11faa7","proxy": {"timestamp": 1573817250172,"method": "GET","host": "my-app.vercel.app","path": "/api/users?page=1","userAgent": ["Mozilla/5.0..."],"referer": "https://my-app.vercel.app","region": "sfo1","statusCode": 200,"clientIp": "120.75.16.101","scheme": "https","vercelCache": "MISS"}}

When you configure a Log Drain in the Vercel UI, you can set which sources to receive logs from:

valueDetails
staticRequests to static assets like HTML and CSS files
lambdaOutput from Vercel Functions like API Routes
edgeOutput from Vercel Functions using Edge runtime
buildOutput from the Build Step
externalExternal rewrites to a different domain
firewallOutputs log data from requests denied by Vercel Firewall rules

When you configure a Log Drain in the Vercel UI, you can set which environments to receive logs from:

valueDetails
productionLogs from production deployments with assigned domain(s)
previewLogs from deployments accessed through the generated deployment URL

When you configure a Log Drain in the Vercel UI, you can set the sampling rate to control the volume of data sent. This helps manage costs when you have high traffic volumes.

For more information on Log Drains and how to use them, check out the following resources: