Create a server log insight hub: user‑agent taxonomy, crawl latency heatmaps, 3xx/4xx…
- User
Create a server log insight hub: user‑agent taxonomy, crawl latency heatmaps, 3xx/4xx leak detection, render errors, and trend alerts.
Assistant
Create a server log insight hub: user‑agent taxonomy, crawl latency heatmaps, 3xx/4xx leak detection, render errors, and trend alerts.
The user wants a server log insight hub - a comprehensive dashboard for analyzing server logs. Let me break down the requirements:
Let me design a sophisticated, visually striking dashboard with:
For the design:
Color scheme:
Let me create this comprehensive dashboard with:
I'll make it responsive and interactive with meaningful animations.
A comprehensive, real-time server log analysis dashboard with a dark industrial aesthetic and amber/cyan accent system. Features interactive visualizations for user-agent taxonomy, latency heatmaps, status code leak detection, render error tracking, and trend alerts.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Server Log Insight Hub</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #08080c;
--bg-elevated: #0e0e14;
--card: #121218;
--card-hover: #18181f;
--border: #1e1e28;
--border-glow: #2a2a38;
--fg: #e8e8ed;
--fg-muted: #6b6b7a;
--fg-dim: #3d3d4a;
--accent-amber: #f59e0b;
--accent-amber-dim: #b45309;
--accent-cyan: #06b6d4;
--accent-cyan-dim: #0891b2;
--success: #10b981;
--warning: #f59e0b;
--error: #ef4444;
--info: #3b82f6;
}
* {
box-sizing: border-box;
}
body {
font-family: 'Space Grotesk', sans-serif;
background: var(--bg);
color: var(--fg);
min-height: 100vh;
}
.font-mono {
font-family: 'JetBrains Mono', monospace;
}
.bg-grid {
background-image:
linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
background-size: 32px 32px;
}
.bg-noise {
position: relative;
}
.bg-noise::before {
content: '';
position: absolute;
inset: 0;
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
pointer-events: none;
z-index: 0;
}
.glow-amber {
box-shadow: 0 0 40px rgba(245, 158, 11, 0.15);
}
.glow-cyan {
box-shadow: 0 0 40px rgba(6, 182, 212, 0.15);
}
.card {
background: var(--card);
border: 1px solid var(--border);
transition: all 0.3s ease;
}
.card:hover {
border-color: var(--border-glow);
background: var(--card-hover);
}
.status-badge {
display: inline-flex;
align-items: center;
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
font-family: 'JetBrains Mono', monospace;
}
.status-2xx { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-3xx { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.status-4xx { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-5xx { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.heatmap-cell {
transition: all 0.15s ease;
}
.heatmap-cell:hover {
transform: scale(1.3);
z-index: 10;
}
.alert-item {
border-left: 3px solid transparent;
transition: all 0.2s ease;
}
.alert-item:hover {
background: var(--card-hover);
}
.alert-critical { border-left-color: var(--error); }
.alert-warning { border-left-color: var(--warning); }
.alert-info { border-left-color: var(--info); }
.progress-ring {
transform: rotate(-90deg);
}
.donut-segment {
transition: all 0.3s ease;
cursor: pointer;
}
.donut-segment:hover {
opacity: 0.8;
transform: scale(1.02);
transform-origin: center;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.animate-fade-in {
animation: fadeInUp 0.5s ease forwards;
opacity: 0;
}
.animate-pulse-slow {
animation: pulse 2s ease-in-out infinite;
}
.tab-btn {
position: relative;
padding: 0.5rem 1rem;
color: var(--fg-muted);
transition: all 0.2s ease;
}
.tab-btn.active {
color: var(--accent-cyan);
}
.tab-btn.active::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 2px;
background: var(--accent-cyan);
}
.tab-btn:hover:not(.active) {
color: var(--fg);
}
.log-entry {
font-family: 'JetBrains Mono', monospace;
font-size: 0.75rem;
line-height: 1.6;
padding: 0.5rem;
border-bottom: 1px solid var(--border);
transition: background 0.15s ease;
}
.log-entry:hover {
background: var(--card-hover);
}
.scrollbar-thin::-webkit-scrollbar {
width: 6px;
height: 6px;
}
.scrollbar-thin::-webkit-scrollbar-track {
background: var(--bg);
}
.scrollbar-thin::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 3px;
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
background: var(--border-glow);
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
.trend-up { color: var(--error); }
.trend-down { color: var(--success); }
.trend-stable { color: var(--fg-muted); }
</style>
</head>
<body class="bg-grid bg-noise">
<div class="relative z-10 min-h-screen">
<!-- Header -->
<header class="border-b border-[var(--border)] bg-[var(--bg-elevated)]">
<div class="max-w-[1600px] mx-auto px-4 py-4">
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-4">
<div class="flex items-center gap-4">
<div class="w-10 h-10 rounded-lg bg-gradient-to-br from-amber-500 to-orange-600 flex items-center justify-center">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
</svg>
</div>
<div>
<h1 class="text-xl font-bold tracking-tight">Server Log Insight Hub</h1>
<p class="text-sm text-[var(--fg-muted)]">Real-time log analysis and anomaly detection</p>
</div>
</div>
<div class="flex items-center gap-6">
<div class="flex items-center gap-2">
<span class="w-2 h-2 rounded-full bg-green-500 animate-pulse-slow"></span>
<span class="text-sm text-[var(--fg-muted)] font-mono">Live</span>
</div>
<div class="text-sm text-[var(--fg-muted)] font-mono" id="currentTime">--:--:--</div>
<button class="px-3 py-1.5 bg-[var(--card)] border border-[var(--border)] rounded-md text-sm hover:border-[var(--accent-cyan)] transition-colors flex items-center gap-2" onclick="refreshData()">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
</svg>
Refresh
</button>
</div>
</div>
</div>
</header>
<!-- Stats Bar -->
<div class="border-b border-[var(--border)] bg-[var(--bg-elevated)]">
<div class="max-w-[1600px] mx-auto px-4 py-3">
<div class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4">
<div class="animate-fade-in" style="animation-delay: 0.1s">
<div class="text-xs text-[var(--fg-muted)] uppercase tracking-wider mb-1">Total Requests</div>
<div class="text-2xl font-bold font-mono" id="statTotal">2.4M</div>
</div>
<div class="animate-fade-in" style="animation-delay: 0.15s">
<div class="text-xs text-[var(--fg-muted)] uppercase tracking-wider mb-1">Avg Latency</div>
<div class="text-2xl font-bold font-mono text-[var(--accent-cyan)]" id="statLatency">142ms</div>
</div>
<div class="animate-fade-in" style="animation-delay: 0.2s">
<div class="text-xs text-[var(--fg-muted)] uppercase tracking-wider mb-1">Error Rate</div>
<div class="text-2xl font-bold font-mono text-[var(--error)]" id="statError">2.3%</div>
</div>
<div class="animate-fade-in" style="animation-delay: 0.25s">
<div class="text-xs text-[var(--fg-muted)] uppercase tracking-wider mb-1">Active Bots</div>
<div class="text-2xl font-bold font-mono text-[var(--accent-amber)]" id="statBots">847</div>
</div>
<div class="animate-fade-in hidden lg:block" style="animation-delay: 0.3s">
<div class="text-xs text-[var(--fg-muted)] uppercase tracking-wider mb-1">Redirect Chains</div>
<div class="text-2xl font-bold font-mono text-[var(--info)]" id="statRedirects">23</div>
</div>
<div class="animate-fade-in hidden lg:block" style="animation-delay: 0.35s">
<div class="text-xs text-[var(--fg-muted)] uppercase tracking-wider mb-1">Active Alerts</div>
<div class="text-2xl font-bold font-mono text-[var(--warning)]" id="statAlerts">12</div>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<main class="max-w-[1600px] mx-auto px-4 py-6">
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6">
<!-- Left Column -->
<div class="lg:col-span-4 space-y-6">
<!-- User-Agent Taxonomy -->
<div class="card rounded-xl p-5 animate-fade-in" style="animation-delay: 0.4s">
<div class="flex items-center justify-between mb-4">
<h2 class="font-semibold text-lg">User-Agent Taxonomy</h2>
<span class="text-xs text-[var(--fg-muted)] font-mono">Last 24h</span>
</div>
<div class="flex items-center justify-center mb-4">
<svg viewBox="0 0 200 200" class="w-48 h-48">
<g id="donutChart"></g>
<text x="100" y="95" text-anchor="middle" class="fill-[var(--fg)] text-2xl font-bold">100%</text>
<text x="100" y="115" text-anchor="middle" class="fill-[var(--fg-muted)] text-xs">Classified</text>
</svg>
</div>
<div class="space-y-2" id="userAgentList"></div>
</div>
<!-- Top Bots -->
<div class="card rounded-xl p-5 animate-fade-in" style="animation-delay: 0.5s">
<div class="flex items-center justify-between mb-4">
<h2 class="font-semibold text-lg">Top Crawlers</h2>
<select class="bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1 text-sm focus:outline-none focus:border-[var(--accent-cyan)]" id="botTimeRange">
<option value="24h">24h</option>
<option value="7d">7 days</option>
<option value="30d">30 days</option>
</select>
</div>
<div class="space-y-3" id="topBotsList"></div>
</div>
</div>
<!-- Center Column -->
<div class="lg:col-span-5 space-y-6">
<!-- Latency Heatmap -->
<div class="card rounded-xl p-5 animate-fade-in" style="animation-delay: 0.45s">
<div class="flex items-center justify-between mb-4">
<h2 class="font-semibold text-lg">Crawl Latency Heatmap</h2>
<div class="flex items-center gap-4 text-xs">
<span class="flex items-center gap-1">
<span class="w-3 h-3 rounded-sm" style="background: #06b6d4"></span> Fast
</span>
<span class="flex items-center gap-1">
<span class="w-3 h-3 rounded-sm" style="background: #f59e0b"></span> Slow
</span>
<span class="flex items-center gap-1">
<span class="w-3 h-3 rounded-sm" style="background: #ef4444"></span> Timeout
</span>
</div>
</div>
<div class="overflow-x-auto scrollbar-thin">
<div class="min-w-[500px]">
<div class="flex gap-1 mb-2">
<div class="w-12"></div>
<div class="flex-1 grid grid-cols-24 gap-0.5 text-xs text-[var(--fg-muted)]" id="heatmapHours"></div>
</div>
<div id="heatmapGrid" class="space-y-0.5"></div>
</div>
</div>
</div>
<!-- Status Code Analysis -->
<div class="card rounded-xl p-5 animate-fade-in" style="animation-delay: 0.55s">
<div class="flex items-center justify-between mb-4">
<h2 class="font-semibold text-lg">Status Code Distribution</h2>
<div class="flex gap-2">
<button class="tab-btn active" data-tab="overview">Overview</button>
<button class="tab-btn" data-tab="leaks">Leak Detection</button>
</div>
</div>
<div id="tabOverview" class="tab-content">
<div class="grid grid-cols-4 gap-4 mb-4">
<div class="text-center p-3 rounded-lg bg-[var(--bg)]">
<div class="text-2xl font-bold font-mono text-[var(--success)]" id="status2xx">94.2%</div>
<div class="text-xs text-[var(--fg-muted)]">2xx Success</div>
</div>
<div class="text-center p-3 rounded-lg bg-[var(--bg)]">
<div class="text-2xl font-bold font-mono text-[var(--info)]" id="status3xx">1.8%</div>
<div class="text-xs text-[var(--fg-muted)]">3xx Redirect</div>
</div>
<div class="text-center p-3 rounded-lg bg-[var(--bg)]">
<div class="text-2xl font-bold font-mono text-[var(--warning)]" id="status4xx">2.8%</div>
<div class="text-xs text-[var(--fg-muted)]">4xx Client</div>
</div>
<div class="text-center p-3 rounded-lg bg-[var(--bg)]">
<div class="text-2xl font-bold font-mono text-[var(--error)]" id="status5xx">1.2%</div>
<div class="text-xs text-[var(--fg-muted)]">5xx Server</div>
</div>
</div>
<div class="h-2 rounded-full overflow-hidden bg-[var(--bg)] flex" id="statusCodeBar"></div>
</div>
<div id="tabLeaks" class="tab-content hidden">
<div class="space-y-3" id="leakList"></div>
</div>
</div>
<!-- Render Errors -->
<div class="card rounded-xl p-5 animate-fade-in" style="animation-delay: 0.65s">
<div class="flex items-center justify-between mb-4">
<h2 class="font-semibold text-lg">Render Error Log</h2>
<span class="status-badge status-4xx font-mono" id="renderErrorCount">23 errors</span>
</div>
<div class="max-h-64 overflow-y-auto scrollbar-thin rounded-lg bg-[var(--bg)]" id="renderErrorLog"></div>
</div>
</div>
<!-- Right Column -->
<div class="lg:col-span-3 space-y-6">
<!-- Trend Alerts -->
<div class="card rounded-xl p-5 glow-amber animate-fade-in" style="animation-delay: 0.5s">
<div class="flex items-center justify-between mb-4">
<h2 class="font-semibold text-lg flex items-center gap-2">
<svg class="w-5 h-5 text-[var(--warning)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
</svg>
Trend Alerts
</h2>
<span class="text-xs text-[var(--fg-muted)]">Real-time</span>
</div>
<div class="space-y-2 max-h-96 overflow-y-auto scrollbar-thin" id="alertsList"></div>
</div>
<!-- Latency Distribution -->
<div class="card rounded-xl p-5 animate-fade-in" style="animation-delay: 0.6s">
<h2 class="font-semibold text-lg mb-4">Latency Percentiles</h2>
<div class="space-y-3" id="latencyPercentiles"></div>
</div>
<!-- Quick Actions -->
<div class="card rounded-xl p-5 animate-fade-in" style="animation-delay: 0.7s">
<h2 class="font-semibold text-lg mb-4">Quick Actions</h2>
<div class="grid grid-cols-2 gap-2">
<button class="p-3 bg-[var(--bg)] rounded-lg text-sm hover:bg-[var(--card-hover)] transition-colors text-left">
<svg class="w-5 h-5 mb-1 text-[var(--accent-cyan)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/>
</svg>
Export Logs
</button>
<button class="p-3 bg-[var(--bg)] rounded-lg text-sm hover:bg-[var(--card-hover)] transition-colors text-left">
<svg class="w-5 h-5 mb-1 text-[var(--accent-amber)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"/>
</svg>
Configure
</button>
<button class="p-3 bg-[var(--bg)] rounded-lg text-sm hover:bg-[var(--card-hover)] transition-colors text-left">
<svg class="w-5 h-5 mb-1 text-[var(--success)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
Run Audit
</button>
<button class="p-3 bg-[var(--bg)] rounded-lg text-sm hover:bg-[var(--card-hover)] transition-colors text-left">
<svg class="w-5 h-5 mb-1 text-[var(--info)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/>
</svg>
Set Alerts
</button>
</div>
</div>
</div>
</div>
</main>
</div>
<script>
// Data
const userAgentData = [
{ name: 'Chrome', value: 42.3, color: '#4285f4' },
{ name: 'Safari', value: 18.7, color: '#06b6d4' },
{ name: 'Firefox', value: 12.1, color: '#f59e0b' },
{ name: 'Googlebot', value: 9.8, color: '#10b981' },
{ name: 'Bingbot', value: 5.4, color: '#8b5cf6' },
{ name: 'Other Bots', value: 7.2, color: '#6b7280' },
{ name: 'Others', value: 4.5, color: '#374151' }
];
const topBotsData = [
{ name: 'Googlebot', requests: '847K', trend: 'up', change: '+12%' },
{ name: 'Bingbot', requests: '234K', trend: 'stable', change: '+2%' },
{ name: 'Amazonbot', requests: '156K', trend: 'up', change: '+28%' },
{ name: 'FacebookBot', requests: '89K', trend: 'down', change: '-5%' },
{ name: 'YandexBot', requests: '67K', trend: 'up', change: '+8%' }
];
const leakData = [
{ type: '301 Chain', path: '/old-page → /intermediate → /final', severity: 'warning', count: 156 },
{ type: '404 Spike', path: '/api/v1/deprecated/*', severity: 'critical', count: 2341 },
{ type: '302 Loop', path: '/redirect-test ↔ /redirect-back', severity: 'critical', count: 45 },
{ type: 'Soft 404', path: '/search?q=... (200 but error page)', severity: 'warning', count: 89 },
{ type: '301 → 404', path: '/moved-page → /not-found', severity: 'info', count: 23 }
];
const renderErrors = [
{ time: '14:23:45', error: 'Hydration mismatch in <Dashboard>', path: '/app/dashboard', severity: 'warning' },
{ time: '14:22:12', error: 'ChunkLoadError: Loading chunk 5 failed', path: '/app/analytics', severity: 'critical' },
{ time: '14:21:33', error: 'TypeError: Cannot read property "map" of undefined', path: '/app/logs', severity: 'critical' },
{ time: '14:20:01', error: 'Warning: Each child should have a unique key', path: '/app/users', severity: 'info' },
{ time: '14:18:45', error: 'NetworkError: Failed to fetch API endpoint', path: '/api/health', severity: 'critical' },
{ time: '14:17:22', error: 'ReferenceError: process is not defined', path: '/app/config', severity: 'warning' }
];
const alertsData = [
{ type: 'critical', title: '4xx Error Spike', desc: '404 errors increased 340% in last hour', time: '2m ago', trend: 'up' },
{ type: 'warning', title: 'Latency Degradation', desc: 'P95 latency exceeded 500ms threshold', time: '5m ago', trend: 'up' },
{ type: 'warning', title: 'Bot Traffic Surge', desc: 'Crawlers consuming 45% of bandwidth', time: '12m ago', trend: 'up' },
{ type: 'info', title: 'SSL Cert Warning', desc: 'Certificate expires in 14 days', time: '1h ago', trend: 'stable' },
{ type: 'info', title: 'New Bot Detected', desc: 'Unknown crawler from 185.x.x.x', time: '2h ago', trend: 'stable' }
];
const latencyPercentiles = [
{ label: 'P50', value: 45, max: 200 },
{ label: 'P75', value: 124, max: 300 },
{ label: 'P90', value: 287, max: 500 },
{ label: 'P95', value: 412, max: 600 },
{ label: 'P99', value: 892, max: 1000 }
];
// Generate heatmap data
const heatmapData = [];
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
for (let day = 0; day < 7; day++) {
const row = [];
for (let hour = 0; hour < 24; hour++) {
let base = Math.random() * 100;
if (hour >= 9 && hour <= 17) base += 100;
if (day >= 5) base *= 0.5;
row.push(Math.round(base));
}
heatmapData.push(row);
}
// Initialize
function init() {
updateTime();
setInterval(updateTime, 1000);
renderDonutChart();
renderUserAgentList();
renderTopBots();
renderHeatmap();
renderStatusCodeBar();
renderLeaks();
renderRenderErrors();
renderAlerts();
renderLatencyPercentiles();
setupTabs();
}
function updateTime() {
const now = new Date();
document.getElementById('currentTime').textContent = now.toLocaleTimeString('en-US', { hour12: false });
}
function renderDonutChart() {
const svg = document.getElementById('donutChart');
let cumulativePercent = 0;
const radius = 80;
const circumference = 2 * Math.PI * radius;
userAgentData.forEach((item, index) => {
const percent = item.value / 100;
const dashArray = circumference * percent;
const dashOffset = circumference * cumulativePercent;
const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
circle.setAttribute('cx', 100);
circle.setAttribute('cy', 100);
circle.setAttribute('r', radius);
circle.setAttribute('fill', 'transparent');
circle.setAttribute('stroke', item.color);
circle.setAttribute('stroke-width', 24);
circle.setAttribute('stroke-dasharray', `${dashArray} ${circumference}`);
circle.setAttribute('stroke-dashoffset', -dashOffset);
circle.setAttribute('class', 'donut-segment');
circle.style.transformOrigin = 'center';
circle.addEventListener('mouseenter', () => {
circle.setAttribute('stroke-width', 28);
});
circle.addEventListener('mouseleave', () => {
circle.setAttribute('stroke-width', 24);
});
svg.appendChild(circle);
cumulativePercent += percent;
});
}
function renderUserAgentList() {
const container = document.getElementById('userAgentList');
container.innerHTML = userAgentData.map(item => `
<div class="flex items-center justify-between py-2 border-b border-[var(--border)] last:border-0">
<div class="flex items-center gap-2">
<span class="w-3 h-3 rounded-sm" style="background: ${item.color}"></span>
<span class="text-sm">${item.name}</span>
</div>
<span class="text-sm font-mono text-[var(--fg-muted)]">${item.value}%</span>
</div>
`).join('');
}
function renderTopBots() {
const container = document.getElementById('topBotsList');
container.innerHTML = topBotsData.map(bot => `
<div class="flex items-center justify-between p-2 rounded-lg hover:bg-[var(--bg)] transition-colors">
<div>
<div class="font-medium text-sm">${bot.name}</div>
<div class="text-xs text-[var(--fg-muted)] font-mono">${bot.requests} requests</div>
</div>
<div class="flex items-center gap-2">
<span class="text-xs font-mono ${bot.trend === 'up' ? 'trend-up' : bot.trend === 'down' ? 'trend-down' : 'trend-stable'}">
${bot.change}
</span>
${bot.trend === 'up' ? '↑' : bot.trend === 'down' ? '↓' : '→'}
</div>
</div>
`).join('');
}
function renderHeatmap() {
const hoursContainer = document.getElementById('heatmapHours');
hoursContainer.innerHTML = Array.from({ length: 24 }, (_, i) =>
`<div class="text-center">${i}</div>`
).join('');
const gridContainer = document.getElementById('heatmapGrid');
gridContainer.innerHTML = heatmapData.map((row, dayIndex) => `
<div class="flex gap-1">
<div class="w-12 text-xs text-[var(--fg-muted)] py-1">${days[dayIndex]}</div>
<div class="flex-1 grid grid-cols-24 gap-0.5">
${row.map((value, hourIndex) => {
const color = getLatencyColor(value);
return `<div class="heatmap-cell h-6 rounded-sm cursor-pointer"
style="background: ${color}"
title="${days[dayIndex]} ${hourIndex}:00 - ${value}ms"
data-day="${dayIndex}" data-hour="${hourIndex}" data-value="${value}"></div>`;
}).join('')}
</div>
</div>
`).join('');
}
function getLatencyColor(value) {
if (value < 100) return 'rgba(6, 182, 212, 0.3)';
if (value < 200) return 'rgba(6, 182, 212, 0.5)';
if (value < 300) return 'rgba(16, 185, 129, 0.5)';
if (value < 400) return 'rgba(245, 158, 11, 0.4)';
if (value < 500) return 'rgba(245, 158, 11, 0.6)';
return 'rgba(239, 68, 68, 0.7)';
}
function renderStatusCodeBar() {
const container = document.getElementById('statusCodeBar');
container.innerHTML = `
<div style="width: 94.2%; background: var(--success)"></div>
<div style="width: 1.8%; background: var(--info)"></div>
<div style="width: 2.8%; background: var(--warning)"></div>
<div style="width: 1.2%; background: var(--error)"></div>
`;
}
function renderLeaks() {
const container = document.getElementById('leakList');
container.innerHTML = leakData.map(leak => `
<div class="alert-item alert-${leak.severity} p-3 rounded-r-lg bg-[var(--bg)]">
<div class="flex items-start justify-between mb-1">
<span class="font-medium text-sm">${leak.type}</span>
<span class="status-badge status-${leak.severity === 'critical' ? '5xx' : leak.severity === 'warning' ? '4xx' : '3xx'}">
${leak.count}
</span>
</div>
<div class="text-xs text-[var(--fg-muted)] font-mono truncate">${leak.path}</div>
</div>
`).join('');
}
function renderRenderErrors() {
const container = document.getElementById('renderErrorLog');
container.innerHTML = renderErrors.map(err => `
<div class="log-entry">
<div class="flex items-start gap-2">
<span class="text-[var(--fg-dim)]">${err.time}</span>
<span class="px-1.5 py-0.5 rounded text-xs ${
err.severity === 'critical' ? 'bg-red-500/20 text-red-400' :
err.severity === 'warning' ? 'bg-amber-500/20 text-amber-400' :
'bg-blue-500/20 text-blue-400'
}">${err.severity.toUpperCase()}</span>
</div>
<div class="text-[var(--fg)] mt-1">${err.error}</div>
<div class="text-[var(--accent-cyan)]">${err.path}</div>
</div>
`).join('');
}
function renderAlerts() {
const container = document.getElementById('alertsList');
container.innerHTML = alertsData.map(alert => `
<div class="alert-item alert-${alert.type} p-3 rounded-r-lg bg-[var(--bg)]">
<div class="flex items-start justify-between mb-1">
<span class="font-medium text-sm">${alert.title}</span>
<span class="text-xs text-[var(--fg-muted)]">${alert.time}</span>
</div>
<p class="text-xs text-[var(--fg-muted)]">${alert.desc}</p>
<div class="mt-2 flex items-center gap-2 text-xs ${alert.trend === 'up' ? 'text-red-400' : 'text-[var(--fg-muted)]'}">
${alert.trend === 'up' ? '↑ Escalating' : '→ Stable'}
</div>
</div>
`).join('');
}
function renderLatencyPercentiles() {
const container = document.getElementById('latencyPercentiles');
container.innerHTML = latencyPercentiles.map(p => {
const percentage = (p.value / p.max) * 100;
const color = percentage > 80 ? 'var(--error)' : percentage > 60 ? 'var(--warning)' : 'var(--accent-cyan)';
return `
<div>
<div class="flex items-center justify-between mb-1">
<span class="text-sm font-mono">${p.label}</span>
<span class="text-sm font-mono" style="color: ${color}">${p.value}ms</span>
</div>
<div class="h-2 rounded-full bg-[var(--bg)] overflow-hidden">
<div class="h-full rounded-full transition-all duration-500" style="width: ${percentage}%; background: ${color}"></div>
</div>
</div>
`;
}).join('');
}
function setupTabs() {
const tabBtns = document.querySelectorAll('.tab-btn');
tabBtns.forEach(btn => {
btn.addEventListener('click', () => {
tabBtns.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
const tab = btn.dataset.tab;
document.querySelectorAll('.tab-content').forEach(content => {
content.classList.add('hidden');
});
document.getElementById(`tab${tab.charAt(0).toUpperCase() + tab.slice(1)}`).classList.remove('hidden');
});
});
}
function refreshData() {
// Simulate data refresh with animation
const cards = document.querySelectorAll('.card');
cards.forEach(card => {
card.style.opacity = '0.5';
setTimeout(() => {
card.style.opacity = '1';
}, 300);
});
// Update some values
const statLatency = document.getElementById('statLatency');
const newLatency = Math.round(120 + Math.random() * 60);
statLatency.textContent = `${newLatency}ms`;
const statError = document.getElementById('statError');
const newError = (1.5 + Math.random() * 2).toFixed(1);
statError.textContent = `${newError}%`;
}
// Intersection Observer for scroll animations
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, { threshold: 0.1 });
document.querySelectorAll('.animate-fade-in').forEach(el => {
el.style.opacity = '0';
el.style.transform = 'translateY(20px)';
el.style.transition = 'all 0.5s ease';
observer.observe(el);
});
// Initialize on load
document.addEventListener('DOMContentLoaded', init);
</script>
</body>
</html>
prefers-reduced-motion, semantic HTML