Home > Mobile >  How to get Custom Log tables from Azure Log Analytics Workspace through PowerShell script?
How to get Custom Log tables from Azure Log Analytics Workspace through PowerShell script?

Time:04-14

I am looking for a way to get all custom log tables from an Azure log analytics workspace through PowerShell code.

Below is an example of three custom log tables of which I would like to see the names in an object (array/list/...).

enter image description here

I am able to create a custom log table, insert and check data in it, but I am not able to upfront check if the table already exists, before I query on it.

I am using the Invoke-AzOperationalInsightsQuery PowerShell cmdlet to query on the custom log table, but this fails if the log does not exist yet. Hence the question.

Thanks for your input.

CodePudding user response:

  • I have created sample custom log tables

enter image description here

and executed the below command

Get-AzOperationalInsightsDataSource -Kind CustomLog -ResourceGroupName RGName -WorkspaceName LogAnalyticsWorkSpaceName

enter image description here

Get-AzOperationalInsightsDataSource - Gets datasources under Azure Log Analytics workspace.

  • Related