{"id":18811715,"url":"https://github.com/logicmonitor/lm-logs-azure","last_synced_at":"2025-08-17T13:18:42.523Z","repository":{"id":42371741,"uuid":"286758027","full_name":"logicmonitor/lm-logs-azure","owner":"logicmonitor","description":"Azure integration for sending logs to Logic Monitor","archived":false,"fork":false,"pushed_at":"2024-12-17T05:08:55.000Z","size":33726,"stargazers_count":3,"open_issues_count":2,"forks_count":10,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-27T11:21:32.443Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logicmonitor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-11T13:54:38.000Z","updated_at":"2024-12-17T05:09:01.000Z","dependencies_parsed_at":"2024-02-16T06:24:35.383Z","dependency_job_id":"cf843b32-fe6b-4e93-b7a2-744b2cb47c74","html_url":"https://github.com/logicmonitor/lm-logs-azure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-logs-azure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-logs-azure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-logs-azure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-logs-azure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logicmonitor","download_url":"https://codeload.github.com/logicmonitor/lm-logs-azure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248777614,"owners_count":21159998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T23:27:24.636Z","updated_at":"2025-04-13T20:31:31.937Z","avatar_url":"https://github.com/logicmonitor.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lm-logs-azure(beta)\n\nAzure integration for sending logs to LogicMonitor.\nIt's implemented as [Azure Function](https://azure.microsoft.com/en-us/services/functions/) consuming logs from an [Event Hub](https://azure.microsoft.com/en-us/services/event-hubs/), and forwarding them to LogicMonitor log ingestion REST API.\n\n## Prerequisites\n\n* [Create a LogicMonitor API Token](https://www.logicmonitor.com/support/settings/users-and-roles/api-tokens)\n* [Install Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)\n* [Sign to Azure in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest): execute `az login`\n\n## Deployment\n\nEach Azure region requires a separate deployment. This is because devices can only send logs to Event Hubs within the same region.\n\n### Deploying using Terraform\n\n* Download [deploy.tf file](https://raw.githubusercontent.com/logicmonitor/lm-logs-azure/master/deploy.tf)\n* (optional) Update `app_settings` in the file to set the optional parameters\n* Exceute `terraform init`\n* Execute `terraform plan --var-file terraform.tfvars -out tf.plan`\n* Execute `terraform apply tf.plan`\n\n*NOTE: the deployed function usually doesn't start, please see* [this issue](https://github.com/terraform-providers/terraform-provider-azurerm/issues/8546) *for the details.*\u003cbr\u003e\n*As a workaround, please restart the Function App on the Azure Portal.*\n\n### Deploying using Gradle\n\n#### Azure configuration\n\nGradle plugin can only build the function package and deploy it to Azure. Before it can be used, you need to create an [Event Hub](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-create) and [Function App](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-function-app-portal).\nThe runtime stack should be set to Java version 11. The function uses the following [Application settings](https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings#settings)\n* `LogsEventHubConnectionString` - Event Hub [connection string](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-get-connection-string)\n* `LogicMonitorCompanyName` - Company in the target URL '{company}.logicmonitor.com'\n* `LogicMonitorAccessId` - LogicMonitor access ID\n* `LogicMonitorAccessKey` - LogicMonitor access key\n* `AzureClientID` - Azure Application Client ID\n* `LogApiClientConnectTimeout` (optional) - Connection timeout in milliseconds (default 10000)\n* `LogApiClientReadTimeout` (optional) - Read timeout in milliseconds (default 10000)\n* `LogApiClientDebugging` (optional) - HTTP client debugging: true/false (default false)\n* `LogRegexScrub` (optional) - regex pattern for removing text from the log messages\n\n#### Deployment\n\n* execute `./gradlew -DazureResourceGroup=\u003cyour Azure Function's Resource Group name\u003e -DazureFunction=\u003cyour Azure Function name\u003e azureFunctionsDeploy`\n* if your account has multiple subscriptions, you need to add `-DazureSubscription=\u003csubscription ID\u003e`\n\n#### Running locally\n\nGradle can be also run the function locally for debugging purposes.\n\n* Install [Azure Functions Core Tools 2.0 and above](https://www.npmjs.com/package/azure-functions-core-tools)\n* copy the application settings to `local.settings.json` file\n* execute `./gradlew azureFunctionsRun`\n* you can use remote debugging on port 5005 (it can be modified in `build.gradle` file, setting `localDebug`)\n\n## Logging\n\nLogging type and level can be configured using [Azure CLI webapp log config](https://docs.microsoft.com/en-us/cli/azure/webapp/log?view=azure-cli-latest#az-webapp-log-config) command, for example:\n\n`az webapp log config --resource-group \u003cyour Azure Function's Resource Group name\u003e --name \u003cyour Azure Function name\u003e --application-logging true --level verbose --detailed-error-messages true`\n\nThen they can be observed using [Azure CLI webapp log tail](https://docs.microsoft.com/en-us/cli/azure/webapp/log?view=azure-cli-latest#az-webapp-log-tail)\n\n`az webapp log tail --resource-group \u003cyour Azure Function's Resource Group name\u003e --name \u003cyour Azure Function name\u003e`\n\n## Forwarding Azure logs to Event Hub\n\nAfter the deployment is complete, the Azure function listens for logs from the Event Hub. We need to redirect them there from resources.\nFor most of them, this can be done by [creating diagnostic settings](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/diagnostic-settings). If the function was deployed using Terraform, the logs should be sent to Event Hub named `log-hub` in namespace `lm-logs-\u003cLM company name\u003e-\u003cAzure region\u003e`.\n\n### Linux Virtual Machines\n\nForwarding Linux VM's system and application logs requires [installation of diagnostic extension](https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/diagnostics-linux#installing-the-extension-in-your-vm) on the machine.\n\n#### Prerequisites\n\n* [Install Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)\n* [Sign to Azure in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest): execute `az login`\n* Install wget: execute `sudo apt-get install wget`.\n\n#### Configuration\n\n* Download the configuration script: `wget https://raw.githubusercontent.com/logicmonitor/lm-logs-azure/master/vm-config/configure-lad.sh`\n* execute it to create the storage account needed by the extension, and the configuration files: `./configure-lad.sh \u003cLM company name\u003e`\n* update `lad_public_settings.json` to configure types of system logs and their levels (`syslogEvents`), and application logs (`fileLogs`) to collect\n* execute `az vm extension set --publisher Microsoft.Azure.Diagnostics --name LinuxDiagnostic --version 3.0 --resource-group \u003cyour VM's Resource Group name\u003e --vm-name \u003cyour VM name\u003e --protected-settings lad_protected_settings.json --settings lad_public_settings.json` - the exact command was printed by the `configure-lad.sh` script\n\n### Windows Virtual Machines \n\nForwarding Windows VM's system and application logs requires [installation of diagnostic extension](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/diagnostics-extension-windows-install) on the machine.\n\n#### Prerequisites\n\n* [Install Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)\n* Install Azure CLI via PowerShell:\n`Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\\AzureCLI.msi`\n* [Sign to Azure in with Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest): execute `az login`\n\n#### Configuration\n\n* Download the configuration script: `Invoke-WebRequest -Uri https://raw.githubusercontent.com/logicmonitor/lm-logs-azure/master/vm-config/configure-wad.ps1 -OutFile .\\configure-wad.ps1`\n* execute it to create the storage account needed by the extension, and the configuration files: `.\\configure-wad.ps1 -lm_company_name \u003cLM company name\u003e`\n* update `wad_public_settings.json` to configure types of [event logs](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/diagnostics-extension-schema-windows#windowseventlog-element) (`Applicaiton, System, Setup, Security, etc`) and their levels (`Info, Warning, Critical`) to collect\n* execute `az vm extension set --publisher Microsoft.Azure.Diagnostics --name IaaSDiagnostics --version 1.18 --resource-group \u003cyour VM's Resource Group name\u003e --vm-name \u003cyour VM name\u003e --protected-settings wad_protected_settings.json --settings wad_public_settings.json` - the exact command was printed by the `configure-wad.ps1` script\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Flm-logs-azure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogicmonitor%2Flm-logs-azure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Flm-logs-azure/lists"}