Use the Real-time Webtask Logs Extension in High Activity Production Environments

Overview

This article will advise how to use the Real-time Webtask Logs Extension in production environments with a lot of activity and be able to pick useful and relevant data among the results. This will be useful for debugging or troubleshooting issues with all the extensibility code in an Auth0 tenant, including Actions, Custom Database Action Scripts, etc.

Applies To

  • Real-time Webtask Logs Extension
  • Debug
  • Extensions
  • Webtask
  • Actions
  • Custom Database scripts

Solution

To troubleshoot specific scenarios in extensibility code, even in production, add some specific word or phase at the beginning of your console.logs to differentiate those from other logs. See the following example:

  1. Create a post-login Action with the following code:
console.log("User info from Action");
console.log("Authentication methods: ", event.authentication?.methods);

if (event.user.email === "YOUR TEST USER EMAIL ADDRESS") {
    console.log("Test - Connection: ", event.connection.strategy);
    console.log("Test - Logins count: ", event.stats.logins_count);
    console.log("Test - User attributes: ", event.user);
    console.log("Test - Risk Assesment: ", event.authentication?.riskAssessment);
}
  1. If there are many users logging in at the time you check the activity in the Real-time Webtask Logs Extension, all that activity is logged too fast to track any specific users. The ‘if’ conditional in the Action above handles this issue.
  2. In the Real-time Webtask Logs Extension, there is a search bar on top. Use it to filter logs by a specific word or phrase. In the example, look for “Test”
  3. Only the output for the console.logs that start with the word “Test” should be visible, which are only triggered for the test user. See below a screenshot for this example: