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.
az login
Each Azure region requires a separate deployment. This is because devices can only send logs to Event Hubs within the same region.
app_settings
in the file to set the optional parametersterraform init
terraform plan --var-file terraform.tfvars -out tf.plan
terraform apply tf.plan
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.
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
LogsEventHubConnectionString
- Event Hub connection stringLogicMonitorCompanyName
- Company in the target URL '{company}.logicmonitor.com'LogicMonitorAccessId
- LogicMonitor access IDLogicMonitorAccessKey
- LogicMonitor access keyAzureClientID
- Azure Application Client IDLogApiClientConnectTimeout
(optional) - Connection timeout in milliseconds (default 10000)LogApiClientReadTimeout
(optional) - Read timeout in milliseconds (default 10000)LogApiClientDebugging
(optional) - HTTP client debugging: true/false (default false)LogRegexScrub
(optional) - regex pattern for removing text from the log messages./gradlew -DazureResourceGroup=<your Azure Function's Resource Group name> -DazureFunction=<your Azure Function name> azureFunctionsDeploy
-DazureSubscription=<subscription ID>
Gradle can be also run the function locally for debugging purposes.
local.settings.json
file./gradlew azureFunctionsRun
build.gradle
file, setting localDebug
)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>
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>
.
Forwarding Linux VM's system and application logs requires installation of diagnostic extension on the machine.
az login
sudo apt-get install wget
.wget https://raw.githubusercontent.com/logicmonitor/lm-logs-azure/master/vm-config/configure-lad.sh
./configure-lad.sh <LM company name>
lad_public_settings.json
to configure types of system logs and their levels (syslogEvents
), and application logs (fileLogs
) to collectaz vm extension set --publisher Microsoft.Azure.Diagnostics --name LinuxDiagnostic --version 3.0 --resource-group <your VM's Resource Group name> --vm-name <your VM name> --protected-settings lad_protected_settings.json --settings lad_public_settings.json
- the exact command was printed by the configure-lad.sh
scriptForwarding Windows VM's system and application logs requires installation of diagnostic extension on the machine.
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
az login
Invoke-WebRequest -Uri https://raw.githubusercontent.com/logicmonitor/lm-logs-azure/master/vm-config/configure-wad.ps1 -OutFile .\configure-wad.ps1
.\configure-wad.ps1 -lm_company_name <LM company name>
wad_public_settings.json
to configure types of event logs (Applicaiton, System, Setup, Security, etc
) and their levels (Info, Warning, Critical
) to collectaz vm extension set --publisher Microsoft.Azure.Diagnostics --name IaaSDiagnostics --version 1.18 --resource-group <your VM's Resource Group name> --vm-name <your VM name> --protected-settings wad_protected_settings.json --settings wad_public_settings.json
- the exact command was printed by the configure-wad.ps1
script