Use Case:
To push performance counter logs from Azure Windows Virtual Machine to Azure Event Hub.
Pre- Requisites :
To achieve the above-said pipeline, this blog assumes that you have the following resources under your Azure subscription:
Steps Taken:
We would be using a diagnostics.wadcfgx file that would be used to push the logs from VM to the event hub entity. The steps to be taken are:
Download the diagnostics.wadcfgx file from here and update the placeholders with details accordingly. The placeholders to be updated are :
Keep the file name and extension as diagnostics.wadcfgx while you save it. Please make sure that you pass the event hub namespace level connection string and not the instance one for this setup.
Once the file is saved, open the PowerShell on the local machine and connect to the Azure account using the command Connect-AzAccount
After you have logged in, run this PowerShell script to push the extension to the VM.
Select-AzSubscription -SubscriptionId 9cee3d8e-05bb-xxxx-xxxx-xxxxxxxxxx
$rgName = "<Resource Group Name>"
$vmName = "<Windows VM Name>"
$diagnosticsconfig_path = "<Local path where the .wadcfgx file is stored>"
$diagnosticsstorage_name = "<Storage Account Name>"
$diagnosticsstorage_key = " <Storage Account Key>"
Set-AzVMDiagnosticsExtension -ResourceGroupName $rgName -VMName $vmName -DiagnosticsConfigurationPath $diagnosticsconfig_path -StorageAccountName $diagnosticsstorage_name -StorageAccountKey $diagnosticsstorage_key
After the operation has been successful, you would see a success output on the PowerShell console window. This means that the pipeline has been set-up and logs would be pushed from VM to the event hub.
Looking at the event hub metrics (messages section) from the portal, you would be able to confirm that there has been traffic traversing the event hub.
Looking into the data that has been pushed into the event hub, we can confirm the VM perf logs have been successfully pushed. Here is a screenshot.
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.