Skip to main content
Sumo Logic

Webhook Connection for AWS Lambda

You can trigger an AWS Lambda function directly from a Scheduled Search or Metrics Monitor by configuring a Webhook Connection in Sumo Logic.

For example, you can create a Scheduled Search that triggers a Lambda function when too many requests are received from a suspicious IP address. The Lambda function can shut down additional requests from that IP address, while simultaneously sending a notification to the security team for review.

Build an API in the API Gateway to Expose a Lambda Function

First, generate an Invoke URL for your Lambda function by creating an API in Amazon API Gateway. For information about exposing an HTTP endpoint, see Amazon's API Gateway documentation:

http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html

When you have created the Invoke URL, copy and paste it into a notepad. You will need it in to configure the Webhook Connection in the next section.

Create a Webhook Connection

Configure the Webhook Connection to trigger the AWS Lambda function.

  1. Go to Manage > Connections.
  2. On the Connections page click Add.
  3. Click AWS Lambda.
  4. In the Create Connection dialog, enter:
    1. Name. Enter a name for the Connection.
    2. Description. Optional: Enter a Description for the Connection.
    3. URL. Enter the Invoke URL from the previous section.
    4. Access Key and Secret Key. Enter your AWS Access Key and Secret Key.
    5. Region. Select your region.
    6. Service Name. Enter execute-api as service name.
    7. Payload. Enter a JSON object in the format required. For details on variables that can be used as parameters within your JSON object, see Webhook Payload Variables
  5. Click Test Connection. If the connection is made, you will see a 200 OK response message.
  6. Click Save.

Create a Scheduled Search

To trigger the Webhook Connection, you can use a Scheduled Search. The following is an example configuration.

  1. Create a search query and click Save As below the search field.
  2. Click Schedule this search.
    1. Run Frequency. Select Hourly.  
    2. Time range for scheduled search. Select Last 60 Minutes.
    3. Alert Condition. Select Send notification only if the condition below is satisfied.
    4. Number of results. Enter Greater than > 0.
    5. Alert Type. Select Webhook to upload search results to your Connection.
    6. Webhook. Select the Webhook you created in the previous section.
    7. Customize Payload. (Optional) If needed, select the check box and customize the Payload for this search. If you’d like to use the default payload, leave this as-is.
  3. Click Save.

Create a Metrics Monitor

Alternatively, to trigger the Webhook Connection, you can use a Metrics Monitor. For instructions, see Metrics Monitors and Alerts