Skip to main content
Sumo Logic

Collect Logs from Azure Blob Storage

This page has instructions for configuring a pipeline for shipping logs available from Azure Blob Storage to an Event Hub, on to an Azure Function, and finally to an HTTP source on an hosted collector in Sumo Logic. 

Functional overview

  1. You configure the Azure service to export logs to a container in a storage account created for that purpose.
  2. You create an Event Grid subscription with the storage container as publisher and the event hub (created by the Sumo-provided ARM) as subscriber. Event Grid routes block blob creation events to event hub.
  3. Event Hub streams the events to the TaskProducer Azure function, which creates tasks (a JSON object that specifies start and end byte, container name, blob path) and pushes those tasks to the service bus task queue.
  4. The TaskConsumer Azure function, which is triggered when the service bus receives a new task, reads the block blob, from start byte to stop byte, and sends that data to Sumo. 
  5. The set up also includes failure handling mechanism. For more information about the solution strategy, see Azure Blob Storage.

Step 1. Configure Azure storage account 

In this step you configure a storage account to which you will export monitoring data for your Azure service.   

If you have a storage account you want to use for this purpose, make a note of its connection string and proceed to Step 2. Otherwise, create a new storage account.  For instructions, see Create a storage account in Azure help.

To obtain the connection string for a storage account

  1. In the Azure portal, select Storage accounts in the left pane. 
  2. Select the storage account that you have created for exporting logs.
  3. Under Settings, select Access keys, and make a note of the connection string under key1.

Step 2. Configure an HTTP source

 In this step, you configure an HTTP source to receive logs from the Azure function.

  1. Select a hosted collector where you want to configure the HTTP source. If desired, create a new hosted collector, as described on Configure a Hosted Collector.
  2. Configure an HTTP source, as described on HTTP Logs and Metrics Source. Make a note of the URL for the source, you will need it in the next step.

Step 3. Configure Azure resources using ARM template

In this step, you use a Sumo-provided Azure Resource Manager (ARM) template to create an Event Hub, three Azure functions, Service Bus Queue, and a Storage Account.

  1. Download the blobreaderdeploy.json ARM template.
  2. Go to Template deployment in the Azure Portal.
  3. Click Create.
  4. On the Custom deployment blade, click Build your own template in the editor.
  5. Copy the contents of the template and paste it into the editor window.
  6. Click Save.
  7. Now you are back on the Custom deployment blade.
    1. Create a new Resource Group (recommended) or select an existing one.
    2. Choose Location.
    3. Set the value of the SumoEndpointURL parameter to the URL for the HTTP source you configured in Step 2.
    4. Set the value of the StorageAcccountConnectionString parameter to the value of the connection string you noted in Step 1.
    5. Agree to the terms and conditions.
    6. Click Purchase.
  8. Verify the deployment was successful by looking at Notifications at top right corner of Azure Portal.
  9. (Optional) In the same window, you can click Go to resource group to verify the all resources were successfully created. You will see something like this:
  10. Go to Storage accounts and search for “sumobrlogs”. Click on “sumobrlogs<random-string>”.
  11. Under Table Service:
    1. Click Tables.
    2. Click + Table.
    3. For Name, enter “FileOffsetMap:
  12. Click OK.

Step 4. Create an Event Grid Subscription

  1. In the left pane of Azure portal click All Services. Search for “Event Grid Subscriptions” and click it.
  2. Click +Event Subscription. The Create Event Subscription pane appears.
  3. In the Create Event Subscription pane appears:
    1. Topic Type. Select Storage Accounts.
    2. Subscription. Select the Subscription.
    3. Resource Group. Select the Resource Group for the Storage Account to which your Azure service will export logs, which you created in Step 1
    4. Resource. Select the Storage Account you configured in Step 1
    5. In the Event Types section:
      1. Uncheck the Subscribe to all event types box.
      2. Select Blob Created from the Define Event Types dropdown.
    6. Endpoint Type. Select Event Hubs from the dropdown. 
    7. Endpoint.  Click on Select an endpoint. 
    8. The Select Event Hub popup appears:
      1. Resource Group. Select the resource group you created Step 4
      2. Event Hub Namespace. Select SUMOBREventHubNamespace<unique string>.
      3. Event Hub. Select blobreadereventhub from the dropdown.
      4. Click Confirm Selection.
    9. In the Event Subscription Details section:
      1. Name. Enter the subscription name.
      2. Event Schema. Select Event Grid Schema from the dropdown
    10. In the Filters section, to filter events by container name, enter the following in the Subject Begins With field, replacing <container_name> with the name of the container you created in Step 2:
    11. Click Create
  4. Verify the deployment was successful by looking at Notifications in the top right corner of the Azure Portal.

Step 5. Push logs from Azure Service to Azure Blob Storage

This section describes how to push logs from an Azure service to Azure Blob Storage by configuring Diagnostic Logs. The instructions use the Azure Web Apps Service as an example. 

  1. Login to the Azure Portal.
  2. Click AppServices > Your Function App > Diagnostic Logs under Monitoring.
  3. You will see the Diagnostic Logs blade. Enable Application Logging, Web Server Logging, or both, and click Storage Settings.
  4. Select the Storage Account whose connection string you configured in the ARM template in Step 3
  5. You will see the Containers blade. Select an existing container, or create a new one. To create a container:
    1. Select + Container,
    2. Enter the Name, and
    3. Select Private for the Public Access Level.
    4. Click OK.
  6. You will see the Diagnostic Logs blade again. Specify the retention days and click Save to exit Diagnostic Logs configuration.