# Event Hub Source

## Overview

Panther supports configuring an [Azure Event Hub](https://learn.microsoft.com/en-us/azure/event-hubs/) as a Data Transport to pull log data directly from your Event Hub namespace, allowing you to write detections and perform investigations on this processed data.

Data sent to Panther can be in various formats, including JSON or plain text.

## How to set up an Azure Event Hub log source in Panther

### Prerequisites

* You have an [Event Hubs namespace](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-features#namespace) and within it, an Event Hub.
* Verify that the necessary Azure resource provider is registered for your subscription:
  1. Log in to the Azure Portal and navigate to **Subscriptions**.
  2. Select the subscription where your Event Hub resources are located.
  3. Under the subscription settings, select **Resource providers**.
  4. In the **Filter by name** field, search for `Microsoft.EventHub`.
  5. Ensure that the **Status** column for `Microsoft.EventHub` shows **Registered**. If the status is instead **NotRegistered**, register it by following the Azure [Register resource provider](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types#register-resource-provider) documentation.

### Step 1: Configure Azure Event Hub in Panther

1. In the left-hand navigation bar of your Panther Console, click **Configure** > **Log Sources**.
2. In the upper-right corner, click **Create New**.
3. Click the **Azure Event Hub** tile.
4. On the **Basic Info** page, fill in the following:
   * **Name**: Enter a descriptive name for your log source.
   * **Log Types**: Select one or more log types to associate with this log source.
5. Click **Setup**.
6. On the **Log Format** page, select the [stream type](https://docs.panther.com/custom-log-types/reference#stream-type) of the incoming logs:
   * **Auto**
   * **Lines**
   * **JSON**
   * **JSON Array**

{% hint style="warning" %}
If you plan to ingest Azure logs (such as Activity or Resource logs) with this Event Hub:

1. Select **JSON Array**.
2. Set the **Is the JSON Array enclosed in a field?** toggle to **Yes**.
3. In the **Enclosing Field Name** field, enter `records`**.**

<img src="https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-3bf186144213e2a8ce2b6ca18e901a08d8ffa26f%2Fimage.png?alt=media" alt="" data-size="original">
{% endhint %}

7. Click **Continue**.
   * The **Configuration** page will load.

### Step 2: Add a shared access policy to your Event Hub

To allow Panther to access your Event Hub, create a [shared access policy](https://learn.microsoft.com/en-us/azure/event-hubs/authorize-access-shared-access-signature#shared-access-authorization-policies) with the **Listen** permission:

1. In a separate browser tab, log in to the Azure Portal, then navigate to **Event Hubs**.
2. Select the Event Hub namespace in which your logs are hosted.
3. On the **Overview** page, in the E**vent Hubs** section, select the name of the Event Hub you want to onboard.

   <figure><img src="https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-19be01756f9aae44c94f3ce69980e9125f297edf%2Fimage.png?alt=media" alt="Under an &#x22;eventhubnamespacenickk&#x22; title is a dashboard. An arrow is drawn to a section header reading &#x22;Event Hubs (3).&#x22;" width="563"><figcaption></figcaption></figure>
4. Under **Settings**, click **Shared access policies**.
5. Click **+ Add** to create a new policy.
6. In the **Add SAS Policy** slide-out panel:
   1. In the **Policy name** field, provide a descriptive name (e.g., `PantherListener`).
   2. Click the **Listen** checkbox.
   3. Click **Create**.
7. Click the name of the policy you just created.
8. Copy the **Primary connection string** value and store it in a secure location, as you’ll need it in the next step.

### Step 3: Finish Azure Event Hub source setup in Panther

1. Return to your Event Hub source setup in the Panther Console.
2. On the **Configuration** page, provide the following configuration values:
   * **Connection String**: Enter the **Primary connection string** value you copied in the previous step.
   * (Optional) **Consumer Group**: If you have configured a [consumer group](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-features#consumer-groups) in your Event Hub, you can specify it here. Otherwise, the default consumer group, `$Default`, will be used.

     <figure><img src="https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-a8c16d987f50863194191da3decf49ccb546fb55%2Fimage.png?alt=media" alt="Under a &#x22;Configuration&#x22; title is the header &#x22;Create a Connection string in your Azure Portal.&#x22; There are two form fields: Connection String and Consumer Group (Optional)."><figcaption></figcaption></figure>
3. Click **Setup**. You will be directed to a success screen:

<figure><img src="https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-e55cedf82c6a6adc66ec5c14ebdcb164c3b1dcca%2FScreenshot%202023-08-03%20at%204.33.30%20PM.png?alt=media" alt="The success screen reads, &#x22;Everything looks good! Panther will now automatically pull &#x26; process logs from your account&#x22;" width="281"><figcaption></figcaption></figure>

* You can optionally enable one or more [Detection Packs](https://docs.panther.com/detections/panther-managed/packs).
* If you have not done so already, click **Attach or Infer Schemas** to attach one or more schemas to the source.
* The **Trigger an alert when no events are processed** setting defaults to **YES**. We recommend leaving this enabled, as you will be alerted if data stops flowing from the log source after a certain period of time. The timeframe is configurable, with a default of 24 hours.

  <figure><img src="https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-c48119abd559990173004bde99ff4907fdd2ded2%2FScreenshot%202023-08-03%20at%204.26.54%20PM.png?alt=media" alt="The &#x22;Trigger an alert when no events are processed&#x22; toggle is set to YES. The &#x22;How long should Panther wait before it sends you an alert that no events have been processed&#x22; setting is set to 1 Day" width="320"><figcaption></figcaption></figure>

## Viewing ingested logs

After your log source is configured, you can search ingested data using [Search](https://docs.panther.com/search/search-tool) or [Data Explorer](https://docs.panther.com/search/data-explorer).
