Share via


Consultas para a tabela ApiManagementGatewayLogs

Número de pedidos

Conte o número total de chamadas em todas as APIs nas últimas 24 horas.

//Total number of call per resource
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize count(CorrelationId) by _ResourceId 

Registos das últimas 100 chamadas

Obtenha os registos das 100 chamadas mais recentes nas últimas 24 horas.

ApiManagementGatewayLogs
| top 100 by TimeGenerated desc 

Número de chamadas por APIs

Veja o número de chamadas por API nas últimas 24 horas.

//Calls by API ID
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize count(CorrelationId) by ApiId

Largura de banda consumida

Largura de banda total consumida nas últimas 24 horas.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| extend bandwidth = RequestSize + ResponseSize 
| summarize sum(bandwidth) by bin(TimeGenerated, 15m), _ResourceId 
| render timechart 

Tamanhos do pedido

Estatísticas dos tamanhos dos pedidos nas últimas 24 horas.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(RequestSize), Median=percentile(RequestSize, 50), 90th_Percentile=percentile(RequestSize, 90) by bin(TimeGenerated, 5m) 
| render timechart 

Tamanhos de resposta

Estatísticas dos tamanhos de resposta nas últimas 24 horas.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(ResponseSize), Median=percentile(ResponseSize, 50), 90th_Percentile=percentile(ResponseSize, 90) by bin(TimeGenerated, 5m) 
| render timechart 

Versões do TLS do Cliente

Discriminação das versões TLS do cliente nas últimas 24 horas.

ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize count(CorrelationId) by ClientTlsVersion, _ResourceId 

Discriminação dos motivos de erro

Discriminação de todos os motivos de erro nas últimas 24 horas.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| where IsRequestSuccess == false
| summarize count(CorrelationId) by LastErrorReason, _ResourceId

Últimos 100 pedidos falhados

Obtenha os registos dos últimos 100 pedidos falhados.

ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| where IsRequestSuccess == false
| top 100 by TimeGenerated desc| where ResponseCode >= 400

Obtenha os registos de pedidos falhados devido a problemas de back-end.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| where IsRequestSuccess == false
| where BackendResponseCode >= 400

Obtenha os registos de pedidos falhados devido a problemas não relacionados com o back-end (por exemplo, configuração de políticas de Gestão de API, limite de taxa excedido, desconexão do cliente).

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| where IsRequestSuccess == false
| where isnull(BackendResponseCode) or BackendResponseCode < 400
| where ResponseCode >= 400

Latência geral

Estatísticas de latência geral (em milissegundos) entre o momento em que o Mangement da API começa a receber um pedido e a hora em que Gestão de API termina o envio da resposta para o cliente.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(TotalTime), Median=percentile(TotalTime, 50), 90th_Percentile=percentile(TotalTime, 90) by bin(TimeGenerated, 15m) 
| render timechart 

Latência de back-end

Estatísticas do tempo (em milissegundos) gastos em E/S de back-end.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(BackendTime), Median=percentile(BackendTime, 50), 90th_Percentile=percentile(BackendTime, 90) by bin(TimeGenerated, 15m) 
| render timechart 

Latência do cliente

Estatísticas do tempo (em milissegundos) gastos em E/S de cliente.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(ClientTime), Median=percentile(ClientTime, 50), 90th_Percentile=percentile(ClientTime, 90) by bin(TimeGenerated, 15m) 
| render timechart 

Proporção de acesso à cache

Estatísticas da proporção de acerto/falha da cache.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Cache_Miss=countif(Cache  == "miss"), Cache_Hit=countif(Cache == "hit") by bin(TimeGenerated, 15m)
| extend Ratio=Cache_Hit / (Cache_Hit + Cache_Miss)
| project-away Cache_Hit , Cache_Miss 
| render timechart