logicmonitor / lm-logs-azure

Azure integration for sending logs to Logic Monitor
Apache License 2.0
3 stars 10 forks source link

lm-logs-azure(beta)

Azure integration for sending logs to LogicMonitor. It's implemented as Azure Function consuming logs from an Event Hub, and forwarding them to LogicMonitor log ingestion REST API.

Prerequisites

Deployment

Each Azure region requires a separate deployment. This is because devices can only send logs to Event Hubs within the same region.

Deploying using Terraform

NOTE: the deployed function usually doesn't start, please see this issue for the details.
As a workaround, please restart the Function App on the Azure Portal.

Deploying using Gradle

Azure configuration

Gradle plugin can only build the function package and deploy it to Azure. Before it can be used, you need to create an Event Hub and Function App. The runtime stack should be set to Java version 11. The function uses the following Application settings

Deployment

Running locally

Gradle can be also run the function locally for debugging purposes.

Logging

Logging type and level can be configured using Azure CLI webapp log config command, for example:

az webapp log config --resource-group <your Azure Function's Resource Group name> --name <your Azure Function name> --application-logging true --level verbose --detailed-error-messages true

Then they can be observed using Azure CLI webapp log tail

az webapp log tail --resource-group <your Azure Function's Resource Group name> --name <your Azure Function name>

Forwarding Azure logs to Event Hub

After the deployment is complete, the Azure function listens for logs from the Event Hub. We need to redirect them there from resources. For most of them, this can be done by creating diagnostic settings. If the function was deployed using Terraform, the logs should be sent to Event Hub named log-hub in namespace lm-logs-<LM company name>-<Azure region>.

Linux Virtual Machines

Forwarding Linux VM's system and application logs requires installation of diagnostic extension on the machine.

Prerequisites

Configuration

Windows Virtual Machines

Forwarding Windows VM's system and application logs requires installation of diagnostic extension on the machine.

Prerequisites

Configuration