-
Notifications
You must be signed in to change notification settings - Fork 7
Enable logging in Azure Log Analytics
DevCDR can write Logs to Azure Log Analytics. This is an optional feature and you have to do the following steps to enable it:
- Azure Log Analytics Workspace (Free is able to hold Log-Entries for 7 days)
In the Azure App Service for DevCDR, select Configuration and add two new Application Settings:
- Log-WorkspaceID : [your WorkspaceID from Log Analytics]
- Log-SharedKey : [your SharedKey from Log Analytics]
you have to restart the app service to start logging to Log-Analytic.
Note: it may take a moment until you see the log entries
Install the "WriteAnalyticsLog" PowerShell Module from the PowerShell gallery on every client:
Install-Module -Name WriteAnalyticsLog -Force
To store your connection information on the client use "Set-LogAnalytics" Cmdlet to enter your WorkspaceId and SharedKey:
Set-LogAnalytics -WorkspaceID <string> -SharedKey <string> -LogType <string>
Note: You have to run the Set-LogAnalytics command with your details on every client
Each Client will encrypt the connection information and store it in registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\itnetx\WriteAnalyticsLogs]
"ConnectionString"="<encrypted data>"
If you want to store a custom Log-Entry you can use the command:
Write-Log -JSON <Object> [-LogType <string>]
Example:
Write-Log -JSON ([pscustomobject]@{Computer = $env:COMPUTERNAME; EventID = 9999}) -LogType "DevCDRCore"
Note: it may take a moment until you can query the data in Azure Log Analytics