Azure Event Hub

Azure Connector pulls logs from Azure Event Hubs service.

Prerequisites

The following prerequisites are to be met:

  • Create a resource group
  • Create a storage account
  • Create an Event Hubs namespace
  • Create a container
  • Create an Event Hub
  • Storage Account Access Keys
  • Connection String for Event Hub
Create a resource group

  • Upon clicking, you will be redirected to the Resource Group page. From there, click on “+Create“.


  • For Subscription, select the name of the Azure subscription in which you want to create the resource group.
  • Enter a unique name for the resource group. The system immediately checks if the name is available in the currently selected Azure subscription.
  • Select a region for the resource group.
  • Click Review + Create.

  • On the Review + Create page, select Create.

Create a Storage Account

To create an Azure storage account with the Azure portal, follow these steps:

  • In the search bar, type “Storage accounts” and then double-click on the result.
  • On the Storage accounts page, click on “Create.”


  • The following image shows a standard configuration for a new storage account.

Create an Event Hubs namespace
  • An Event Hubs namespace provides a unique scoping container, in which you create one or more event hubs.

To create a namespace in your resource group using the portal, do the following actions:

  • In the Azure portal, select Create a resource at the top left of the screen.
  • Upon clicking Event Hubs you will land on the Event Hubs page.
  • Now click on  “+ Create.”


  • On the Create namespace page, follow the steps below:
    • Select the subscription in which you want to create the namespace.
    • Select the resource group you created in the previous step.
    • Enter a name for the namespace. The system immediately checks to see if the name is available.
    • Select a location for the namespace.
    • Select Review + Create at the bottom of the page.



  • On the Review + Create page, review the settings, and select Create. Wait for the deployment to complete



  • On the Deployment page, select Go to resource to navigate to the page for your namespace.



  • Ensure that you see the Event Hubs Namespace page similar to the following screen




    Note: The connector is only responsible for reading data from the $Default consumer group of the Event Hub.

Create a Container

To create a container in the Azure portal, follow these steps:

  • Navigate to your new storage account in the Azure portal.
  • In the left menu for the storage account, scroll to the Blob service section, then select Containers.
  • Select the + Container button.
  • Set the level of public access to the container. The default level is Private (no anonymous access).
  • Select OK to create the container.


  • To change the container access level go to the containers page from the Data storage section then select the container you want to change the access level.


  • Then change the access level to “Container”.


  • Please ensure to store the container name in a location where it can be accessed for use in the connector configuration.

Create an event hub

To create an event hub within the namespace, do the following actions:

  • On the Event Hubs Namespace page, select Event Hubs in the left menu.
  • At the top of the window, select + Event Hub.


  • Type a name for your event hub, then click Review + Create.


  • The partition count setting allows you to parallelize consumption across many consumers. For more information, see Partitions.
  • The message retention setting specifies how long the Event Hubs service keeps data. For more information, see Event retention.
  • You can check the status of the event hub creation in alerts. After the event hub is created, you can view it in the list of event hubs.



  • You can now stream data to the configured Event Hub.
  • If you want to test streaming data to Event Hub, you need to enable Diagnostic Settings for an Azure resource. We recommend using an existing Azure resource.
  • The following example demonstrates how to enable diagnostic settings for any Azure solution:
    • Navigate to the Azure solution page.
    • In the left menu, use the search bar to search for “Monitoring.”


  • Then, click on Diagnostic settings. This will take you to the “Diagnostic settings” page for the Azure solution you selected.
  • Next, click on + Add diagnostic setting.

  • Now, select the log type in Category details that you want to ingest.
  • Select the Stream to an event hub checkbox and then select the following:
    • Subscription: Pull-down, select a subscription.
    •  Event Hub Namespace: Pull-down, select the namespace created in the previous step.
    •  Event Hub name (optional): Select the Event Hub name created in the previous step.
    • Event hub policy name: Leave the default policy.
    • RootManageSharedAccessKey, or select another as desired.


  • Storage accounts and eventhubs should have owner access roles assigned.
    OR
Storage Account Access Keys
  • Storage accounts should have owner access roles assigned.
  • On creating a storage account, Azure generates two 512-bit storage account access keys. These keys can be used to authorize access to data in your storage account via Shared Key authorization. Your storage account access keys are similar to a root password for your storage account.
  • You can view and copy your account access keys with the Azure portal, PowerShell, or Azure CLI. The Azure portal also provides a connection string for your storage account that you can copy.
  • To view and copy your storage account access keys or connection string from the Azure portal:
    • Navigate to your storage account in the Azure portal.
    • Under Security + Networking, select Access keys. Your account access keys appear, as well as the complete connection string for each key.


    • Locate the Key value under key1, and click the Copy button to copy the account key.
    • Alternatively, you can copy the entire connection string. Find the Connection string value under key1, and click the Copy button to copy the connection string.

    • You can use either of the two keys to access Azure Storage, but in general it’s a good practice to use the first key, and reserve the use of the second key for when you are rotating keys.
Connection String for Event Hub
  • Select All services on the left navigational menu.
  • In the list of event hubs, select your event hub.
  • On the Event Hubs Namespace page, select Shared Access Policies on the left menu.




  • Select a shared access policy in the list of policies. The default one is named: RootManageSharedAccessPolicy. You can add a policy with appropriate permissions (read, write), and use that policy.




  • Select the copy button next to the Connection string-primary key field.




Configurations

The following are the configurations to forward Azure Event Hub Connector logs to DNIF.‌

Field Name Description
Connector NameEnter a connector name
Connector TypeEnter Azure EventHub connector
Azure Storage Connection StringEnter the Azure Storage Connection String got from Azure console
Azure Connection StringEnter the Azure connection String got from event hub on Azure console.
Event Hub NameEnter the event hub name got from Azure console.
Container NameEnter the container name where you want to store the bookmarking for eventhub partitions.

Click Save, to forward Azure Event Hub Connector logs to DNIF.‌