Application Logs


Stitch logs all incoming requests and application events such as user authentication, trigger execution, and service interactions. You can access your application’s logs from the Logs page in the Stitch UI or request them programmatically through the Stitch Admin API. Stitch saves logs for 30 days.


Log Entry

A log entry describes a single event within MongoDB Stitch. Different events in MongoDB Stitch execute in different ways, requiring various permissions, underlying components and services. Stitch groups log entries based on the type of event or request that they record. Each type of log contains fields that describe that particular event or request. As a result, your application logs may include entries of the following types:

  • Authentication Requests, including user creation, login, and deletion.
  • Functions, including both Stitch Functions as well as Service Functions, like MongoDB Atlas.
  • Triggers, including Database Triggers, Authentication Triggers, and Scheduled Triggers.
  • Service Requests, including webhooks and service action calls issued from the Stitch client SDK on iOS, Android, and Node.js.
  • Mobile Sync, the propagation of changes between MongoDB Mobile and remote MongoDB data stores. This type also includes Change Streams.

Parts of a Log Entry

Section Description
Metadata MongoDB Stitch logs contain details like the status, timestamp, elapsed time, unique id, user, name, and type of a given log entry.
Request Info Log entries can contain several types of request details, including event arguments, service name, function call location, compute resources used, remote IP address, SDK, platform version, and performance metrics. Requesting log entries via the Stitch Admin API will expose these as top-level fields in log entry objects. On the Stitch UI, clicking on a log entry will expose this information.
Arguments Stitch logs the arguments passed to Functions, including Service requests. Other log entries do not preserve a record of arguments.
Error Info When a Stitch event exits unsuccessfully, it generates an Error log entry containing debugging information that can help diagnose what caused the issue.

Log Filters

Because Stitch creates log entries for most common kinds of user interaction, it can become difficult to find a specific group of logs due to the sheer volume of logs an application generates. For performance reasons, Stitch limits individual queries to a maximum of 100 log entries per page. You can filter entries by type, status, timestamp, user, and request ID to return only logs that are relevant to your query.

Error Logs

All Stitch log entries have one of two possible statuses: OK and Error. If an event exits successfully, Stitch generates an OK log entry based on the event. If an event does not exit successfully for any reason, Stitch creates a log entry with a status of the Stitch Error that caused the problem. You may encounter errors if you:

  • Attempt to access data from MongoDB Atlas for which there is no applicable rule
  • Fail to catch an exception or promise rejection in a Stitch Function
  • Call for a service which does not exist
  • Call a MongoDB Atlas service action with invalid or missing parameters


Log Lines

Functions can log information using JavaScript’s console.log() method. Stitch stringifies each console log and stores each string as a single line. Stitch truncates lines to 256 bytes in length. For ASCII character sets, this translates to 256 characters; depending on the character set you use, you may see truncation at lower character counts.

Stitch saves only the first 10 log lines for a given log entry.

Stitch stores each string as a single line in the log entry’s Logs field.

Log Retention

MongoDB Stitch retains logs for 30 days, after which point they are deleted. If you require logs older than 30 days, you can use the admin log API prior to the 30 day expiration date of each log to extract and externally store your log history.

Reference Documentation

Subject Description
Authentication Logs This page describes the form and content of authentication logs as well as the events that lead to their creation.
Change Stream Logs This page describes the form and content of change stream logs as well as the events that lead to their creation.
Function Logs This page describes the form and content of function logs as well as the events that lead to their creation.
Trigger Logs This page describes the form and content of trigger logs as well as the events that lead to their creation.