Monitoring you MSOMS Log Analytics Usage

While the Log Analytics portal can’t alert you on usage, I have created a simple mechanism to give me an alert if my daily usage is over a certain threshold and also send me a daily summary (and keep track for history purposes). I’m using Azure automation for the task. The way Microsoft exposes usage for now is via this PowerShell command (s ): Get-AzureRmOperationalInsightsWorkspaceUsage The problem is that is will show the current daily usage only: Which is what you see here in the portal: The CurrentValue will be reset at 00:00 (12:00AM GMT). The solution is based in a single script, with different parameters: get-omsusage Parameters Default   [string]$ResourceGroup N/A Get the resource group from your Azure Portal [string]$WSName N/A Same as above [string]$maxDailyCost 0.36 Set a daily cost limit [bool]$reportnotify false Use this flag to send a summary report [bool]$notifyIfOverLimit false Use this flag to check if you are over your daily limit. You will be notified by mail [bool]$logToAzureTable false Use this flag to write an entry to an Azure Table with the current daily usage Internal script variables configuration To make the script flexible, I’m using different variables to represent your environment: The $StorageAccount variable defines the name of your storage account The $StorageAccountKeyStoredVariable Variable is an Azure Automation variable name, which will contain your Storage Key (encrypted). This is NOT the key itself....

Read More