Home / CDN Analytics / CDN Error Rate Monitoring
CDN Analytics

CDN Error Rate Monitoring: 4xx, 5xx Trends, and Anomaly Detection

By Michael Chen, Network Security Engineer  •  September 5, 2026  •  8 min read

A 0.3% 5xx spike at the edge can mean thousands of failed API calls per minute. Learn how to instrument, trend, and detect anomalies in CDN error rates before users notice.

Every request that traverses your CDN tells a story. Most end with a successful 2xx or a cache-efficient 3xx, but the small percentage that return 4xx and 5xx status codes contain disproportionate operational value. Left unmonitored, a 0.5% uptick in 5xx errors can translate to thousands of failed checkouts, API timeouts, or broken assets per minute at scale. Effective CDN error rate monitoring is not about counting failures after the fact — it is about detecting shifts in client and server behavior in real time, correlating them with deployments, cache states, and origin health, and triggering automated or human intervention before user impact escalates. This guide provides a practical framework for monitoring, trending, and detecting anomalies in CDN error rates, built for engineers responsible for availability and performance. We will cover metric design, trend interpretation, and production-ready anomaly detection techniques you can implement today.

Why Error Rate Is Your Leading Availability Indicator

Latency and throughput get the dashboards, but error rate is the most sensitive leading indicator of availability. Unlike synthetic checks that sample a few paths, error rate aggregates every real user request across all Points of Presence (POPs). When you understand how CDN works to terminate TLS, apply caching logic, and proxy to origin, you realize the CDN is the ideal vantage point to observe both client-side misuse and server-side failure.

A well-instrumented CDN emits structured logs for every request: status code, cache status (HIT, MISS, PASS, STALE), POP, ASN, URL path, and origin latency. Aggregating these into error rates gives you three critical capabilities:

Rule of thumb: Track error rates (errors / total requests) not just counts. A flat count of 1,000 5xx/min means something very different at 10k RPS vs. 500k RPS during a traffic spike.

Decoding 4xx vs. 5xx at the Edge

Treating all 4xx and 5xx as “errors” obscures root cause. At the CDN layer, the distinction is critical.

Performance Comparison: Edge vs Origin Processing
Metric Edge Processing Origin Processing Improvement
Latency (p50)8–15 ms120–300 ms15–20x faster
Cache Hit Ratio85–95%N/AReduces origin load
TLS Handshake1–5 ms (nearby PoP)50–150 ms10–30x faster
Bandwidth Cost$0.01–0.04/GB$0.05–0.12/GB3–5x cheaper
Availability99.99% (multi-PoP)99.9% (single DC)10x fewer outages

4xx: Client Errors That Still Need Monitoring

4xx responses indicate the client sent a request the server could not or would not fulfill. They are often dismissed as “user fault,” but at the CDN they frequently signal configuration or deployment issues:

Key insight: 4xx errors are usually cacheable and cheap for origin, but they pollute cache and analytics if not filtered. More importantly, a 404 storm after a purge can look like an outage to real users.

5xx: Server Errors That Demand Immediate Action

5xx errors mean the server (edge or origin) failed to fulfill a valid request. These directly impact SLOs and require burn-rate alerting.

Unlike 4xx, 5xx should almost never be cached. Ensure your CDN caching strategies correctly bypass cache on 5xx and serve stale-on-error where appropriate.

CategoryCodesTypical CDN CausePrimary SignalAction
Client Misconfig400, 411Bot traffic, SDK bugHigh 400 rate on single User-AgentFilter, block, fix client
Auth / WAF401, 403Signed URL expiry, WAF false positive403 spike after rule deployReview WAF, rotate tokens
Missing Asset404Bad purge, rename without redirect404 on HIT, path-specificPurge correctly, add fallback
Rate Limited429Edge rate limiting, bot mitigation429 + high RPS per IPTune thresholds
Origin Failure500, 502App crash, invalid headersMISS + high origin latencyRollback, scale origin
Origin Unreachable503, 504, 521-524Timeout, DNS, TLS failurePOP-specific, no origin logCheck origin health, network

Core Metrics: Beyond Simple Percentages

Raw error rate is a starting point. Production monitoring requires dimensional, SLO-aware metrics.

1. Normalized Error Rate: error_rate = (4xx + 5xx) / total_requests sliced by POP, cache status, path pattern, and ASN. Always compute separately for 4xx and 5xx — combining them hides origin failures behind client noise.

2. Origin Error Ratio: origin_5xx / origin_requests where origin_requests = MISS + PASS + STALE. This isolates origin health from edge-served traffic. A 2% origin 5xx with 90% cache hit ratio is a 0.2% global 5xx — easy to miss without this slice.

3. Error Budget Burn Rate: If your SLO is 99.9% availability (43m error budget/month), burn rate = current_error_rate / (1 - SLO). A burn rate of 10x means you will exhaust the monthly budget in ~3 days. Alert on burn rate, not absolute rate.

4. Cache Poisoning Indicator: Ratio of 404/403 served as HIT. A cache that stores 404s due to misconfigured Cache-Control will amplify a transient origin 404 into a prolonged outage.

CDN Error Rate Monitoring Pipeline Flow from clients through edge POPs and origin, with log aggregation and anomaly detection. Clients Browsers / APIs Edge POPs Cache HIT / MISS / PASS 4xx • 5xx Logs Structured Log Stream MISS Origin App / Storage Aggregation & Time-Series DB Prometheus • ClickHouse • BigQuery Anomaly Detection EWMA • Z-Score • SLO Burn Alert & Mitigate PagerDuty • Auto Failover
Figure 1: CDN error telemetry pipeline — from edge logs to aggregation and anomaly detection. Separate edge and origin error streams for accurate attribution.

Analyzing Trends: Seasonality, Deploys, and Drift

Error rates are never flat. Understanding normal variation prevents alert fatigue.

Seasonality: Most CDNs show diurnal and weekly patterns. 4xx rates often rise during business hours as API clients generate more validation errors, while 5xx may spike during nightly batch jobs that stress origin. Compare week-over-week, not just hour-over-hour. A 0.2% 5xx at 3 AM is more anomalous than 0.4% at peak.

Deployment correlation: Overlay error rate time series with deploy markers, cache purge events, and WAF rule pushes. A step-function increase in 404 within 2 minutes of a frontend deploy is almost certainly an asset path regression. Use annotations in Grafana or Datadog to make this visual.

Drift vs. spike: Slow drift (e.g., 5xx rising 0.02% per day for a week) indicates capacity exhaustion or memory leak at origin — easy to miss with spike-only alerts. Track 7-day rolling averages and slope. A positive slope for 3 consecutive days should trigger a low-severity investigation ticket.

Protocol and POP slices: If you have migrated to HTTP/3 and QUIC, segment error rates by protocol. QUIC handshake failures manifest as 0-RTT 5xx or connection resets that do not appear in HTTP/2 metrics. Similarly, a single POP showing elevated 503 while others are healthy points to regional origin routing or Anycast issues, not global failure.

Anomaly Detection: From Static Thresholds to Adaptive Models

Static thresholds (“alert if 5xx > 1%”) fail at scale. They are either too noisy during traffic troughs or too slow during peaks. Modern CDN monitoring uses adaptive, statistical detection.

1. EWMA and Holt-Winters for Seasonal Baselines

Exponentially Weighted Moving Average (EWMA) gives more weight to recent data while smoothing spikes. For seasonal traffic, Holt-Winters adds trend and seasonality components. Compute expected error rate μ(t) and standard deviation σ(t) per 5-minute bucket, per status class.

Alert when observed_rate > μ + 3σ for two consecutive buckets. This catches sustained deviations while ignoring single-bucket blips from log delivery jitter.

2. Z-Score and Modified Z-Score

For high-cardinality breakdowns (per URL pattern, per POP), z-score is lightweight and explainable. Use median absolute deviation (MAD) instead of standard deviation for robustness to outliers:

# Modified z-score using MAD - robust to spikes
SELECT pop, status_code,
   (error_rate - median_rate) / (1.4826 * mad) AS mod_z
FROM (
  SELECT pop, quantile(0.5)(error_rate) AS median_rate,
         quantile(0.5)(abs(error_rate - median_rate)) AS mad
  FROM cdn_metrics WHERE timestamp > now() - INTERVAL 7 DAY
)

A modified z-score > 3.5 is a strong anomaly signal. Run this every 5 minutes over a 7-day sliding window.

3. SLO Burn-Rate Alerting

The most actionable model for 5xx is multi-window burn-rate. Google SRE recommends two windows:

This balances sensitivity to large outages with tolerance for small blips.

4. Machine Learning for Unknown Unknowns

Isolation Forest or autoencoders on feature vectors (error rate by status, POP, cache status, origin latency) can surface novel failure modes — e.g., a simultaneous rise in 403 and origin latency that indicates WAF-induced origin slowdown. Use ML as a complement, not replacement, for rule-based alerts. Always make ML alerts explainable by surfacing top contributing dimensions.

Production PromQL Example: Adaptive 5xx Alert
# 5xx rate vs EWMA baseline - fires when sustained 3σ deviation
(
   sum(rate(cdn_requests_total{status=~"5.."}[5m]))
  / sum(rate(cdn_requests_total[5m]))
)
> (
   avg_over_time(cdn_5xx_rate_ewma[1h])
   + 3 * stddev_over_time(cdn_5xx_rate_ewma[1h])
)
and increase(cdn_5xx_anomaly_count[10m]) > 1

Pair with recording rules that pre-compute EWMA to reduce query load. Evaluate every 1m, for 5m.

Building Alerts and Runbooks That Actually Help

Detection without response is just expensive logging. Design alerts for actionability.

Alert hierarchy:

Each alert must include context: top 5 URL patterns by error contribution, cache status breakdown, POP distribution, and deploy correlation. Link directly to logs filtered to the anomaly window.

Mitigation patterns: Enable stale-while-revalidate and stale-if-error to serve stale content on 5xx, use load shedding at the edge (return 503 with Retry-After instead of hammering origin), and implement circuit breakers that short-circuit origin fetches when origin 5xx exceeds 20% for 30s.

Pro tip: Test your monitoring with fault injection. Use a canary origin that returns 503 for 1% of requests and verify your anomaly detection fires within 3 minutes. If it doesn’t, your thresholds are too loose.

Conclusion

CDN error rate monitoring is not a dashboard — it is a control system. By separating 4xx and 5xx, normalizing by cache and origin, tracking burn rates, and applying adaptive anomaly detection, you turn noisy logs into early, actionable signals. Start with origin-isolated 5xx burn-rate alerts and EWMA baselines for 4xx, then layer per-POP z-scores and ML for coverage. The goal is simple: detect the shift before users feel it, and give responders the exact slice they need to fix it.

Frequently Asked Questions

What is an acceptable CDN error rate for 5xx errors?

For most production CDNs, sustained 5xx rates should stay below 0.1% of total requests, with an SLO of 99.9% successful origin responses. Burst tolerance is higher, but any 5xx rate above 0.5% for more than 2-5 minutes warrants investigation. Edge-generated 5xx codes like 530 or 503 should be near zero under normal conditions.

How do you distinguish CDN edge errors from origin errors?

Check the CDN response header such as CF-Cache-Status, X-Cache, or Age and the error body. Edge errors often have distinct codes like 520-530, no corresponding origin log entry, and low time-to-first-byte. Origin errors correlate with origin logs, higher origin latency, and cache MISS or PASS status. Correlating edge logs with origin access logs is the definitive method.

Should 4xx errors trigger alerts?

Selective alerting is best. Avoid alerting on absolute 4xx counts and instead monitor for anomalous spikes. Alert on 404 spikes for bad deployments or cache purge errors, 403/401 spikes for WAF or authentication misconfigurations, and 429 for rate limiting. Use anomaly detection with z-scores rather than static thresholds to avoid noise from normal client errors.

What is the best method for CDN anomaly detection?

A hybrid approach works best: use exponentially weighted moving average (EWMA) or Holt-Winters for seasonality-aware baselines on low-cardinality metrics, and modified z-score or isolation forest for high-cardinality breakdowns by POP, URL, and status code. Combine these with SLO burn-rate alerting to prioritize user-impacting anomalies over statistical noise.

External References

References & Standards: HTTP/2 specification · OWASP CDN Security