Monitoring logs and alerts
Access and manage logs from the App Monitor’s “Logs” section to gain valuable insights into your app’s activities. Logs are essential for diagnosing issues and identifying anomalies within your application.
In the logs, you’ll find entries generated by both the system and those created using JavaScript API methods like sys.logs.info() or sys.logs.error().
Logs are organized from the oldest to the newest, and as you scroll down, more logs will be automatically loaded until the entire log history is displayed.
It’s important to note that there’s a limit on the amount of storage allocated for logs (refer to the “Logs and Alerts” section). Once this limit is reached, older logs will be rotated out and removed.
Filtering logs
Logs can be filtered based on various criteria, including log level (info, warn, error), time, and a search string. When filtering by time, you can specify a time duration such as “5m” (for the last five minutes), “2h” (for the last two hours), or “3d” (for the last three days). For more precision, you can also use a date range.
The search string allows you to find log entries containing a specific text or regular expression. For example, by using regex: .*GET.*
, you can filter logs related to HTTP GET requests.
Additional log details
Two flags, "Show IP"
and "Show Location,"
provide supplementary information in logs. Enabling "Show IP"
displays the IP address of the request source (if available), while “Show Location” reveals the geographical location (city/state/country) of the request source (if available).
Log categories
You can choose to view specific categories of logs:
"External Only"
: Displays logs related to interactions between the app and external systems, such as REST API calls or legacy service interactions."UI Only"
: Shows logs originating from user interface (UI) requests.
Exploring log details
Some logs contain extensive information that cannot be displayed in a single log line to maintain readability. Look for a “More Info” button on such logs. Clicking it reveals additional details. For example, in a legacy service event, you can view data sent by the legacy service, error locations within the code, and stack traces—valuable information for debugging.
Contextual log viewing
When filtering logs, you’ll find a “Context” button next to each log entry. Clicking it displays logs both before and after the selected log entry, helping you understand the context of the log without altering your filters.
Alerts
Alerts can be configured based on logs. For instance, in a production environment, you may want to receive alerts when errors or warnings are logged. This can be set up in the App Monitor or App Builder under “Environment Settings > Logs and Alerts.” Refer to the documentation for more details.
Downloading logs
You have the option to export app logs in a compressed JSON format file based on your current filtering selection. The log entries file will be generated as a background task. Once the task completes, the file download will initiate automatically.