This page has instructions for configuring a pipeline for shipping logs available from Azure Monitor to an Event Hub, on to an Azure Function, and finally to an HTTP source on an hosted collector in Sumo Logic. Azure Monitor collects metrics and well as logs. The pipeline described below is for logs, not metrics.
Here’s how the solution fits together:
- Azure Monitor collects logs for most Microsoft Azure services and streams the data to an Azure Event Hub.
- Azure Event Hubs is a data streaming platform and event ingestion service. In this pipeline, an Event Hub streams the logs collected by Azure Monitor to an Azure function.
- The Azure function is a small piece of code that is triggered by Event Hub to send logs to the Sumo HTTP Source, function logs to one Storage Account, and and failover data to another.
For more information about the solution strategy, see Azure Monitoring.
Configure log collection
This section has instructions for setting up the ingestion pipeline, from Azure Monitor all the way to Sumo Logic.
Step 1. Configure an HTTP source
In this step, you configure an HTTP source to receive logs from the Azure function.
Step 2. Configure Azure resources using ARM template
In this step, you use a Sumo-provided Azure Resource Manager (ARM) template to create an Event Hub, an Azure function and two Storage Accounts. The Azure function is triggered by Event Hub. Two storage accounts are used to store log messages from the Azure function and failover data from Event Hub.
- Download the SumoAzure-EventHub.json ARM template.
- Open the template in a text editor.
- On Line 192 of the file, set the
SumoAuditEndpointvalue to the URL for the HTTP source you defined in Step 1.
- Go to Template deployment in the Azure Portal.
- Click Create.
- On the Custom deployment blade, click Build your own template in the editor.
- Copy the contents of
SumoAzure-EventHub.jsonas edited, and paste it into the editor window.
- Click Save.
- Now you are back on the Custom deployment blade.
- Create a new Resource Group (recommended) or select an existing one.
- Choose Location.
- Agree to the terms and conditions.
- Click Purchase.
- Verify the deployment was successful by looking at Notifications at top right corner of Azure Portal.
- (Optional) In the same window, you can click Go to resource group to verify all resources have been created successfully. You will see something like this:
- Go to Storage accounts and search for “sumofail”. Click on “sumofail<random-string>”.
- Under Blob Service, click Containers, then click + Container, enter the Name azureaudit-failover, and select Private for the Public Access Level. Click OK.
Step 3. Push logs from Azure Monitor to Event Hub
Various Azure Services connect to Azure Monitor to send monitoring data to an Event Hub. For more information, see Azure Monitor: Send monitoring data to an event hub in Azure help.
We will use Azure Active Directory Service as an example to push Audit logs to Event Hub with Azure Monitor.
- Login into Azure Portal.
- Click Azure Active Directory > Activity > Audit logs.
- Click Export Settings.
- You will see the Diagnostic Settings blade which will show all your existing settings if any already exist. Click Edit Setting if you want to change your existing settings, or click Add diagnostic setting to add a new one. You can have a maximum of three settings.
- Check the Stream to an event hub box and click on Event hub / Configure.
- Select an Azure subscription.
- Select the Event Hubs namespace you created in Step 2. It should start with “SumoAzure<random-string>”.
- Select "insights-operational-logs" from the Select event hub name dropdown.
- Select "RootManageSharedAccessKey" from Select event hub policy name dropdown.
- Click OK to exit event hub configuration.
- Check the box under “Logs” labeled “Audit”.
- Click Save.
Troubleshooting log collection
If logs are not flowing into Sumo Logic, follow the steps below to investigate the problem.
First, make sure that the resources you created above were successfully created.
- Go to Resource groups, and select resource group you created or selected in Step 2. Configure Azure resources using ARM Template. You should see the five resources you created: an App Service plan, an App Service, an Event Hubs Namespace, and two Storage accounts.
- From the left pane of Azure Portal, Click AppServices, search for “SumoAzureApp”. You should find the “SumoAzureApp<random-string>” Function App. Click it.
- On the Function Apps blade, click Integrate. Verify that the Triggers field value is “Azure Event Hubs” and the Outputs field value is “Azure Blob Storage”.
- In the same window, click the function app settings link. Check that the value of the SumoAuditEndpoint field matches the HTTP source URL.
Verify Event Hub is receiving log messages
To verify that events are appearing in your event hub:
- Navigate to the event hub in the Azure Portal.
- Click the Messages link.
- Message summary information appears below the chart. Check that the Incoming Messages count is greater than zero.
Run the function manually
Perform the steps below to verify that the Azure function is sending messages to Sumo.
- Click EventHubs_Logs under the Function blade.
- Copy and paste the sample payload into the Request Body window
- Click Run. This sends the test payload to the URL for the HTTP source you configured.
- Check the output, and make sure you see “Successfully sent to Sumo” log messages.
2018-04-17T20:30:09.681 [Info] Successfully sent to Sumo
2018-04-17T20:30:09.681 [Info] Sent all data to Sumo. Exit now.
2018-04-17T20:30:09.681 [Info] Function completed (Success, Id=b6ee4119-dd3e-4ba6-9cbd-484a57f822a0, Duration=90ms)
- In Sumo, open a Live Tail tab and make sure you receive the event. Search by the source category you assigned to the HTTP Source that receives the log data, for example: