Skip to content

Azure Event Hub Terraform Module

Using our Terraform modules, you can easily install and manage Coralogix integrations with Azure services as modules in your infrastructure code. This tutorial demonstrates how to install Coralogix function app that connects to your Event Hub and sends logs to Coralogix using the OpenTelemetry (OTLP) protocol.

Our modules are open-source and available on Github and in the Terraform registry.

Prerequisites

  • A resource group and storage account to be used by your function app must be provided as inputs in the Terraform module.

  • The Event Hub namespace and instance must be preexisting.

Installation

To install our function app, which connects to your Event Hub and sends logs to Coralogix, add this declaration to your Terraform project:

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "~> 4.0"
    }
  }
}

provider "azurerm" {
  features {}
}

module "eventhub" {
  source = "coralogix/azure/coralogix//modules/eventhub"

  CoralogixRegion = "EU1"
  CustomDomain = "< Custom FQDN if applicable >"
  CoralogixPrivateKey = "< Send Your Data API Key >"
  CoralogixApplication = "Azure"
  CoralogixSubsystem = "EventHub"
  CoralogixApplicationSelector = "< Optional: Dynamic application selector >"
  CoralogixSubsystemSelector = "< Optional: Dynamic subsystem selector >"
  FunctionResourceGroupName = "< Function ResourceGroup Name >"
  FunctionStorageAccountName = "< Function StorageAccount Name >"
  FunctionAppServicePlanType = "Consumption"
  FunctionAppName = "< Optional: Custom function app name >"
  EventhubInstanceName = "< Name of the existing EventHub Instance >"
  EventhubNamespace = "< Name of the existing Eventhub Namespace >"
  EventhubResourceGroupName = "< Name of the existing Eventhub ResourceGroup >"
  EventhubConsumerGroup = "< Optional: Consumer group name, defaults to $Default >"
  NewlinePattern = "< Optional: Regex pattern to split multi-line logs >"
  BlockingPattern = "< Optional: Regex pattern to filter/block logs >"
}

Notes:

  • Input the following variables:

  • The integration supports JSON objects, JSON arrays, JSON strings, and plain text logs.

  • Descriptions for all the variables can be found here.

  • An SAS policy will be created by the Terraform module to allow listen access to the Event Hub instance by the function app.

  • After the function is created, it needs to be triggered manually for the first time. As part of the module there is an output command to allow you to trigger the function: SyncTriggerCommand

Extensions

Coralogix offers a variety of out-of-the-box data extensions to complement this Terraform module. Each tailored extension package unlocks a set of predefined items – such as alerts, parsing rules, dashboards, saved views, and actions – allowing you to jumpstart the monitoring of your logs.

Select one or more of the following:

Additional Resources

DocumentationCoralogix Terraform Provider
External DocumentationCoralogix Function App
Github: Azure – Coralogix Terraform Module
Terraform Registry

Support

Need help?

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us via our in-app chat or by sending us an email at [email protected].