Freigeben über


Abfragen für die Tabelle "ApiManagementGatewayLogs"

Informationen zur Verwendung dieser Abfragen im Azure-Portal finden Sie im Log Analytics-Lernprogramm. Informationen zur REST-API finden Sie unter "Abfrage".

Anzahl von Anforderungen

Count the total number of calls across all APIs in the last 24 hours.

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

Protokolle der letzten 100 Aufrufe

Get the logs of the most recent 100 calls in the last 24 hours.

ApiManagementGatewayLogs
| top 100 by TimeGenerated desc 

Anzahl der Aufrufe nach APIs

View the number of calls per API in the last 24 hours.

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

Beanspruchte Bandbreite

Total bandwidth consumed in the last 24 hours.

// 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 

Anforderungsgrößen

Statistik der Anforderungsgrößen in den letzten 24 Stunden.

// 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 

Antwortgrößen

Statistik der Antwortgrößen in den letzten 24 Stunden.

// 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 

Client TLS versions

Breakdown of client TLS versions in the last 24 hours.

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

Error reasons breakdown

Aufschlüsselung aller Fehlergründe in den letzten 24 Stunden.

// 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

Last 100 failed requests

Get the logs of the last 100 failed requests.

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

Get the logs of failed requests due to backend issues.

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

Abrufen der Protokolle von fehlgeschlagenen Anforderungen aufgrund von Problemen, die nicht mit dem Back-End zusammenhängen (z. B. API-Konfiguration der Verwaltungsrichtlinien, Ratelimit überschritten, Clientverbindung getrennt).

// 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

Overall latency

Statistiken über die gesamtlatenz (in Milisekunden) zwischen dem Zeitpunkt, zu dem die API-Verwaltung beginnt, eine Anforderung zu empfangen und die Zeit, zu der die API-Verwaltung beendet ist, die Antwort an den Client zurückzusenden.

// 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 

Backend latency

Statistiken zur Zeit (in Milisekunden) für Back-End-E/A.

// 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 

Client latency

Statistiken zur Zeit (in Milisekunden) für Client-E/A.

// 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 

Cachetrefferquote

Statistiken über das Cachetreffer-/Fehlerverhältnis.

// 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