user416593
user416593

Reputation: 13

Can you query the ApiManagementGatewayLogs in Azure using Invoke-AzOperationalInsightsQuery?

I want to query the ApiManagementGatewayLogs table for an API Management service in Azure using Invoke-AzOperationalInsightsQuery. I can query Log Analytics workspaces fine with this command. I am not able to do this with API Management because I cannot find the workspace ID.

In API Management service, the Logs blade (under "Monitor") uses the Log Analytics icon and it leads you to think it may have a workspace underlying it. Having this workspace would let me call Invoke-AzOperationalInsightsQuery with the subscription plus workspace values. I think. Right now, I don't know if there is a workspace associated to the API Management service or if it is a munged storage that gets created with a Log Analytics icon.

Looking at the dedicated Log Analytic workspaces reveals that none have the ApiManagementGatewayLogs table that is found in the API Management service. So it looks like there is no connection between the API Management service and an existing Log Analytics workspace.

If there is no way to query API Management using Invoke-AzOperationalInsightsQuery, is there some Powershell equivalent for querying an API Management service using KQL?

Upvotes: 0

Views: 2112

Answers (1)

user416593
user416593

Reputation: 13

I found the solution to this.

In API Management blade, there is a "Diagnostics settings" link under the Monitoring section.

Your logs will need to be set up here for storage in a storage account, Log Analytics workspace, event hub or partner solution.

If you are using a Log Analytics workspace, then this will be the workspace you use when invoking the Invoke-AzOperationalInsightsQuery Powershell command.

The APIM will ship your ApiManagementGatewayLogs table to the workspace configured in Diagnostic settings.

Upvotes: 0

Related Questions