Matt Can Code  

Issue:  Spike of server error observed and restart required

Observation: Spike in both HTTP Server error and Date out

imageTroubleshoot procedures

1. Applicatioin Insight with KOL

requests
| where success == false
| project timestamp, name, url, resultCode, success, duration
| order by timestamp desc

requests
| where resultCode startswith "5"
| project timestamp, name, url, resultCode, success, duration
| order by duration desc

Not finding anything related to 5xx errors, asssuming some of them might not get server response or might got intercepted by proxy like Nginx

2. Look up the Diagnosis and Solve Problems to access to metrics that describing volumes of server errors

image

image

Linakge to azure

3. Referring to Monitor->Metrics for other metrics like data sizes

image

Linkage 

4. Run Log Analytics to query raw data into entries or aggregated results

image 

Run this to query 

AppServiceHTTPLogs
| where CsUriStem startswith "/api/"
| summarize 
    Details = make_list(pack("Time", TimeGenerated, "Path", CsUriStem, "Status", ScStatus, "Bytes", ScBytes), 10000),
    TotalRequests = count(),
    Http4xxErrors = countif(ScStatus >= 400 and ScStatus < 500),
    Http5xxErrors = countif(ScStatus >= 500),
    TotalResponseBytes = sum(ScBytes),
    AvgResponseBytes = avg(ScBytes),
    MaxResponseBytes = max(ScBytes)

image

5. From AzureMetric to understand the CPU, mem usage

AzureMetrics
| where TimeGenerated >= datetime(2025-12-19T18:00:00Z)
    and TimeGenerated <= datetime(2025-12-19T19:00:00Z)
| where MetricName in ("MemoryWorkingSet", "CpuPercentage", "Http5xx")
| project TimeGenerated, MetricName, Average, Maximum
| order by TimeGenerated asc

image

6. Query against AzureHttpLogs to find all transactions with API filtration 

AppServiceHTTPLogs
| where TimeGenerated >= datetime(2025-12-19T18:00:00Z)
    and TimeGenerated <= datetime(2025-12-19T18:40:00Z)
| project 
    TimeGenerated,
    CsMethod,           // HTTP method (GET, POST, PUT, DELETE)
    CsUriStem,          // URL path
    CsUriQuery,         // Query string parameters
    ScStatus,           // Response status code
    ScBytes,            // Response size (bytes)
    CsBytes,            // Request size (bytes)
    TimeTaken,          // Duration (ms)
    CIp,                // Client IP
    CsHost,             // Host header
    UserAgent,          // User agent
    Cookie              // Cookie header (may be truncated)
 image

posted on 2026-01-16 15:10  Matt Yeung  阅读(0)  评论(0)    收藏  举报