Vercel provides several logging options available for both Deployment Builds and Serverless Function executions. They can be accessed by selecting either "View Build Logs" or "View Function Logs" from the Project View.

The view logs buttons available on a Vercel project.

Note: The "View Function Logs" button is available only for Projects which contain at least one Serverless Function.

Besides on the Project View, the Build and Function Logs can also be accessed directly on the Deployment View too.

Build Logs on the Deployment View.

Functions tab on the Deployment View.

Build Logs

Build logs are generated at Build time for all Deployments. It's similar to the output of your framework's Build Command, with a few minor additions from the Vercel Build system. Once a Build has completed, no further logs will be added to this page.

If any errors or warnings are present in the Build logs, these will be highlighted with different colors (e.g. yellow for warnings, red for errors). This helps you easily identify the cause of any failed Builds and areas you may wish to investigate further.

Build logs are stored indefinitely on each Deployment.

Note: The Build log will automatically be cut-off, if the total size reaches over 4MB.

Function Logs

Function logs provide logging output for your Serverless Functions. This includes user logging such as console.log, along with details of the request made to the Serverless Function.

All function logs are generated on-demand. This means they are only sent to the Serverless Function logs page while it is open in the browser and arrive as each Serverless Function is executed.

Function logs are not stored and will be lost as soon as the Serverless Functions logs page is navigated away from. Requests to cache or static assets are also not stored and never shown. The only exception to this are the failed invocations of Serverless Functions. Those are always persisted.

You can access the Serverless Functions logs page either from the Project View by clicking on the "View Function Logs" button or from the Deployment View by clicking on the "Functions" tab.

Serverless Functions logs page.

On this page you can view the realtime logs of the Serverless Functions in your Deployment. You can also filter them by a specific Serverless Function.

More detailed logs can be activated by clicking on the "Show Details" button.

Details for incoming request to a Serverless Function.

There are several fields describing every incoming request to the Serverless Function:

  • Status: The HTTP response status code.
  • Duration: The time it took the Serverless Function to execute.
  • Init Duration: The time it took the Serverless Function to boot up when it's "cold". If the Serverless Function is "hot" then Init Duration will be N/A.
  • Memory Used: The amount of allocated memory to run the Serverless Function.
  • ID: Unique ID assigned to this Serverless Function.
  • User Agent: The User Agent request header.

Persistence

The Vercel platform, by default, stores failed invocations from Serverless Functions (when the Serverless Function throws an error), and Build logs are stored indefinitely. To store all runtime logs for Serverless Functions with Vercel, we recommend taking advantage of Log Drains through 3rd-party solutions.

Log Drain Solutions

There are several 3rd-party Log Drain Integrations from our Integrations Marketplace that are ready to integrate with Vercel:

Directions on how to set up these Integrations can be found within the Integration Guide links or are provided as part of the installation process.

Integration Request

If the Log Drain Integration you are looking for is not available, please submit feedback as described here.


Last Edited on February 8th 2021