Export Logs to Papertrail

Export Logs to Papertrail

The Auth0 Logs to Papertrail extension consists of a scheduled job that exports your Auth0 logs to Papertrail, a log management service. This document will guide you through the process of setting up this integration.

To learn more, read SolarWinds Papertrail Datasheet at SolarWinds.

Configure a new system in Papertrail

First, you must configure a new system in Papertrail for Auth0 logs and retrieve Papertrail host and port values:

  1. Log in to Papertrail. You'll be redirected to the quick start and tour page.

  2. Click Add your first system. You'll be redirected to a page with a message similar to Your logs will go to logs4.papertrailapp.com:12345 and appear in Events. Note the log host (e.g., logs4.papertrail.com) and port (e.g., 12345); you will need these values in the next section.

Per Papertrail, "no explicit configuration is required... just start sending logs. When Papertrail receives a message from a hostname that is not already present in your account, the system will be automatically added."

Configure the extension

To install and configure this extension:

  1. Navigate to Auth0 Dashboard > Extensions, and select Auth0 Logs to Papertrail. The Install Extension window opens.

    Dashboard - Extensions - Papertrail - Extension Mgmt Papertrail
  2. Set the following configuration parameters, and select Install:

  • Schedule: The frequency with which logs should be exported. The schedule can be customized even further after creation.

  • BATCH_SIZE: The number of logs to be sent per batch. Maximum is 100. Logs are batched before sending, and multiple batches are sent each time the extension runs.

  • START_FROM: The checkpoint ID of the log from which you want to start sending.

  • SLACK_INCOMING_WEBHOOK_URL: The specific Slack webhook to which you want to send reports from the extension.

  • SLACK_SEND_SUCCESS: Choose whether to send verbose notifications to Slack. Useful for troubleshooting.

  • LOG_LEVEL: The minimal log level of events that you would like sent to Papertrail.

  • LOG_TYPES: The events for which logs should be exported.

  • PAPERTRAIL_HOST: The destination hostname for your logs. Enter the host value you retrieved in the previous section.

  • PAPERTRAIL_PORT: The destination port for your logs. Enter the port value you retrieved in the previous section.

  • PAPERTRAIL_SYSTEM: The destination system for your logs. This is what Auth0's logs will be titled in the Papertrail dashboard. When not set, the default value is auth0-logs.

The integration between Auth0 and Papertrail is now in place!

Batch size

When setting your BATCH_SIZE, please keep the following information in mind.

During each time frame/window (defined by your chosen Schedule), outstanding logs will be batched into groups and sent. The size of each group is determined by the BATCH_SIZE value.

In other words, during each window, NUM_BATCHES batches of logs will be sent based on the following logic:

IF (NUM_LOGS modulo 100 == 0): NUM_BATCHES = (NUM_LOGS / BATCH_SIZE) ELSE: NUM_BATCHES = (NUM_LOGS / BATCH_SIZE) + 1

In the ELSE case, the last batch will have < 100 logs.

View results

The integration you just set up created a scheduled job that is responsible for exporting the logs. To view this scheduled job:

  1. Navigate to Auth0 Dashboard > Extensions, and select Installed Extensions.

  2. Select Auth0 Logs to Papertrail. The job you just created appears. You can modify its state by toggling the State switch, see when the next run is due, and see the result of the last execution.

    Dashboard - Extensions - Azure - View Cron Jobs

You can view more details by clicking on the job you created. On this page, you can view details for each execution, reschedule the job, access realtime logs, and more.

Dashboard - Extensions - Azure - View Cron Details

That's it; you are done! You can now navigate to Papertrail and view your Auth0 Logs under Events. Look for what you entered as your value for the PAPERTRAIL_SYSTEM parameter, which is what Auth0's logs will be titled in the Papertrail dashboard. When not set, the default value is auth0-logs.

Replay logs

In the event of a Papertrail failure or service interruption, you can replay the logs starting from the failed log.

To replay logs:

  1. Get the checkpoint ID of the failed log.

  2. Navigate to Auth0 Dashboard > Extensions, and select Installed Extensions.

  3. Select the gear icon to view Auth0 Logs to Papertrail extension settings.

  4. Enter the checkpoint ID in the START_FROM field.

  5. Select Save.

Integrate with Slack

This extension can send failed transaction notifications to Slack with the checkpoint code displayed in the message. To set up the integration:

  1. Get the Slack Incoming Webhook URL.

  2. Navigate to Auth0 Dashboard > Extensions, and select Installed Extensions.

  3. Select the gear icon to view Auth0 Logs to Papertrail extension settings.

  4. Enter the Slack Incoming Webhook URL in the SLACK_INCOMING_WEBHOOK field.

  5. Select Save.

You can also enable verbose notifications by enabling the SLACK_SEND_SUCCESS setting.