Function logs

Netlify provides logs to help you observe and troubleshoot serverless functions in your current production deploy, branch deploys, and Deploy Previews.

# Access function logs

Selecting a serverless function from the list on your site’s Functions page will open the log for that function.

By default, the Functions list displays the serverless functions in the current production deploy. To find functions on another deploy, you can use the dropdown at the top of the list. You can start typing to jump to a particular branch, or find a Deploy Preview by number.

Team Owners and Collaborators can monitor the serverless function logs for a specific deploy by going to the Function logs tab of the Netlify Drawer in a collaborative Deploy Preview.

# Log contents

Netlify displays a log for each serverless function, including:

  • Start of each invocation
  • Any console.log() statements you include in your function code
  • Log statements as each background function is executed

Logs are retained for up to 24 hours, but the history is cleared when there is a new function deployment. A new function deployment happens when a site deploy includes changes to the function code or to the site’s environment variables.

# Date filter

By default, the function log displays a live tail of the Latest logs. You can also filter by data from the Last hour, or select Custom to input a specific date and time range.

# Text filter

You can filter the contents of the log with simple text matches on request ID, message, or log level. Some common log levels include:

  • INFO
  • ERROR
  • WARN
  • FATAL
  • DEBUG
  • TRACE

# Log Drains

This feature may not be available on all plans.

Currently, Netlify supports log drains for Node.js functions. You can connect your function logs to third-party monitoring services for analysis using Netlify’s Log Drains feature. Check out our Log Drains doc for more information.