Zapier

Introduction

Papertrail can invoke a Zapier action using a webhook trigger, which can then invoke any desired action in Zapier.

Setup

Papertrail sends data to a Zapier webhook URL when the alert fires.

Get the URL

  1. Create a new Zap.
  2. Under Built-In Apps, select Webhooks by Zapier, then Catch Hook to create a static webhook that listens for data.
  3. Save the new Zap.

You’ll see the Pick off a Child Key dialog: child_key_dialog.png

To focus on event details, enter payload.events. For other data, enter the related key, or leave it blank to get all the data. Click Continue to show the Zap’s webhook URL and use Copy to clipboard to grab it.

Configure Papertrail

  1. Follow the steps in Alerts, selecting Zapier as the service.
  2. Enter the Zap’s webhook URL in the URL to Zapier trigger field.
  3. Click Create Alert.

Add an action

Once the alert is set up, add an action of your choice to your Zap to process the data, such as sending data to Google Sheets, Gmail, Trello, GitHub, or BitBucket.

Example: Google Sheets

Create a Google spreadsheet with column names corresponding to the fields you’re interested in. For this example, use log event details, and enter fields such as id, received_at, source_ip, source_name, hostname, program, severity, facility, message.

Now that the webhook URL has been created and saved, move on to the Test this Step verification.

Open the saved Papertrail alert and click Send test data. In Zapier, click OK, I did this. Zapier begins waiting to see data come to the hook URL and in a moment, it displays Test successful.

Once the test has succeeded, set up the action. First select the Google Sheets app, then:

  1. Select Create Spreadsheet Row.
  2. Select an account that was previously connected, or connect the account where the spreadsheet was created.
  3. Select the spreadsheet and worksheet created earlier. The column names become a list of fields to provide content for.
  4. Fill in the fields with selections from the payload.
  5. Click Continue and test the new integration. If it works, save it. It’s now an awesome spreadsheet that will dynamically update with details from the matched events when the Papertrail alert fires: log_sheet.png

Example: Custom Slack alerts

First select the Slack app, then:

  1. Select Send Channel Message.
  2. Select an account that was previously connected, or connect the Slack account to send messages to.
  3. Fill in details for the channel and settings. In the Message Text field, use the following fields: Slack message fields or select others, using the button in the upper right of the field.
  4. Click Continue, and check the Slack channel for messages. Each message’s time, sender, program, and message appear, with the time linking directly to the message.

Papertrail offers a direct Slack integration, which is a great choice for most use cases, but running the payload through Zapier provides an easy way to customize the message content.