Server-Side Rendering Crawl Log Anomaly Detector Script
Build a Go or Python log analysis script to detect search bot rendering bottlenecks, crawl budget waste, and 5xx SSR exceptions in real time.
Use this template when managing high-traffic server-side rendered platforms (such as Next.js, Remix, or Nuxt) where search bot crawling strains backend services. It yields a high-throughput streaming script that isolates search engine bots, correlates latency, and reports anomalies.
Role: Principal Site Reliability and Search Systems Infrastructure Engineer.
Context
- Web server access log path or stream: {{server_log_source}}
- Verified search bot IP/CIDR list: {{bot_verification_source}}
- Target HTTP status monitoring matrix: {{monitored_status_codes}}
- Maximum acceptable TTFB threshold in milliseconds: {{latency_threshold_ms}}
- Crawl spike anomaly threshold percentage: {{spike_sensitivity_pct}}
- Diagnostic output destination: {{incident_report_path}}
Task
Develop a high-throughput log analysis script that parses server-side rendering web logs, verifies authentic search engine crawlers, detects crawl budget anomalies and rendering latency spikes, and outputs actionable telemetry reports for engineering and SEO teams.
Method
- Establish a streaming parser capable of reading standard Combined Log Format, JSON logs, or piped inputs from {{server_log_source}}.
- Implement a reverse-DNS and CIDR lookup mechanism using {{bot_verification_source}} to separate legitimate search engine bots from spoofed user agents.
- Filter and bucket requests by bot type (Googlebot, Bingbot, YandexBot, custom web crawlers), HTTP method, and requested path.
- Calculate rolling percentiles (p50, p95, p99) for time-to-first-byte (TTFB) and flag routes exceeding {{latency_threshold_ms}}.
- Monitor and aggregate response codes specified in {{monitored_status_codes}}, categorizing 5xx SSR render timeouts, 4xx broken routes, and 3xx redirect loops.
- Compute crawl volume velocity over rolling time windows, triggering anomaly flags when traffic deviates beyond {{spike_sensitivity_pct}}.
- Correlate slow dynamic SSR routes with specific URL query parameters causing un-cached rendering loops.
- Generate a consolidated diagnostic JSON/Markdown artifact written directly to {{incident_report_path}}.
Constraints
- The script MUST operate in a single-pass streaming mode to avoid out-of-memory errors on log files exceeding 50GB.
- The script MUST NOT perform blocking network lookups synchronously; cache DNS/CIDR evaluations in memory.
- DNS verification must implement strict forward-confirmed reverse DNS (FCrDNS) standards.
- Execution overhead must remain below 5% CPU usage when attached to live server log streams.
Output format
Format the response with the following sections:
- Systems Architecture (100-150 words describing stream handling and FCrDNS verification).
- Standalone Log Parser Script (complete executable Python or Go script with zero placeholder sections).
- Sample Telemetry Output (valid JSON structure showing detected anomalies, latency percentiles, and crawler breakdowns).
Self-review
- Verify that all 6 context variables are used in script configuration flags or data structures.
- Ensure FCrDNS verification logic correctly handles negative caching to prevent socket starvation.
- Confirm that streaming buffer logic properly handles incomplete lines and truncated log rotation transitions.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.