Phantom Logs:把凌晨 3:00 的伺服器與智能家居遙測資料變成鬼故事
Phantom Logs: Turning 3:00 AM Server & Smart-Home Telemetry into Ghost Stories
Phantom Logs 會把伺服器錯誤、Git 提交紀錄及智能家居感應器日誌轉化為三部分的靈異事件報告,並將精確時間戳記、檔案路徑和裝置觸發記錄編織成鬼故事。這個開源工具透過 OpenRouter 呼叫開放權重模型,採用不設資料庫的 Node.js 後端,並提供一鍵遮蔽敏感 IP 和金鑰的選項。
Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
Every developer and smart-home tinkerer knows that weird things happen inside our machines at 3:00 AM. A cron job fails with an unknown permission error, a hallway motion sensor triggers when everyone is asleep, or a zombie process refuses to die. Usually, we just clear the logs and move on.
For the "Ghost in the Machine" theme, I took the prompt literally and built Phantom Logs—a paranormal telemetry analyzer that transforms raw, boring server crashes, git commit histories, and smart-home sensor logs into a chilling gothic investigation.
When you paste your raw logs into the terminal interface, the AI acts as a Paranormal Systems Investigator and generates a structured 3-part incident report:
- Spectral Threat Level: Classifies the haunting based on the severity of your errors (e.g., "Class 4 Poltergeist in node_modules" or "Level 5 Silicon Possession").
- Possessed Telemetry Anomalies: Translates specific timestamps and error codes from your logs into eerie paranormal observations.
- What Happened While You Slept: Weaves the exact timestamps, file paths, and device triggers from your input into a two-paragraph ghost story detailing what walked through your file system in the dark.
Demo
- Live Application: https://phantom-logs.vercel.app
(Click *"Load haunted 3:00 AM sample logs"** inside the app to test it immediately, or paste your own terminal output!)*
Code
The complete source code is public and open-source under the MIT License:
👻 Phantom Logs
Turn Boring 3:00 AM Server & Smart-Home Logs into a Chilling Ghost Story
📸 Demo Preview
🔗 Try it Live: https://phantom-logs.vercel.app
🕯️ The Vibe
Every developer and smart-home owner has boring logs sitting around—like 3:00 AM git commit histories, crashed terminal outputs, or late-night smart-home sensor events ([02:14 AM] Living Room Motion Detected).
What if those glitches weren't bugs, but something lurking inside your machine?
🔮 How It Works
- Paste Your Logs: Drop in raw terminal output, git history, or smart-home activity (or click "Load haunted 3:00 AM sample logs" to test it instantly).
- Optional Quick-Redact: Scrub sensitive IPs and secret keys with one click right in your browser.
-
Uncover the Haunting: Our AI Paranormal Systems Investigator reads the exact timestamps and error codes to generate a complete Paranormal Incident Report
- 🚨 Spectral Threat Level: A spooky classification rating (e.g., "Class 4 Poltergeist in…
How I Built It
Phantom Logs is engineered around a strict, stateless full-stack architecture:
- Frontend: Built with Next.js, Tailwind CSS, and Lucide React, styled in an atmospheric dark-mode terminal palette (deep obsidian, glowing spectral purple, and crimson alert badges).
- Backend: A decoupled Node.js and Express server operating entirely in-memory with zero database persistence.
-
Open-Source AI Core: The backend routes requests through OpenRouter to open-weight models (
nvidia/nemotron-3.5-super-vl:free/meta-llama/llama-3.1-8b-instruct:free). -
3-Layer Resilient JSON Extraction: Open-weight and reasoning models occasionally wrap JSON output in conversational text,
<think>blocks, or markdown fences—or reject strictresponse_formatheaders altogether. To keep the frontend UI bulletproof, I built a 3-layer fallback parser in the backend:-
Layer 1: Strips reasoning tags and attempts standard
JSON.parse(). -
Layer 2 (Boundary Extraction): Dynamically locates the outermost
{and}brackets, sanitizes unescaped control characters, and extracts the JSON payload. -
Layer 3 (Aggressive Regex Fallback): If the model truncates mid-sentence, custom regular expressions extract
threat_level,anomalies, andstorydirectly from the broken text stream so the UI never crashes.
-
Layer 1: Strips reasoning tags and attempts standard
Why Does Open Innovation Matter?
System logs and smart-home telemetry are among the most sensitive data footprints we generate:
- Server and Git logs contain internal file paths, IP addresses, environment structures, and proprietary module names.
- Smart-home sensor logs reveal exact physical routines—when doors unlock, when motion is detected in the living room, and when a household is asleep.
Pasting raw server telemetry or home automation logs into a closed commercial API is a massive security and privacy risk, as closed platforms log prompts and harvest user inputs for corporate model training.
Open innovation makes Phantom Logs safe to actually use:
- Zero Data Retention (Stateless RAM Purge): By pairing open-weight models with a zero-database Node.js backend, your logs exist in temporary memory for a few seconds during inference and are immediately exorcised the moment your story renders.
-
Unfiltered Creative Persona: Closed frontier models are heavily sanitized for corporate neutrality and frequently break character when prompted to act "possessed" or sinister. Open-weight models allow full control over system prompts and temperature (
0.4), letting the gothic storyteller persona shine without corporate guardrails watering down the atmosphere.
The Spirit of It
While testing the app late at night, I fed it a mix of a failed cron backup daemon and a smart-thermostat temperature drop at 02:14:09 AM.
Watching the terminal indicator pulse "Scanning timestamps for ectoplasmic anomalies..." and return a story describing how an unknown_entity locked the backup daemon from the inside while draining the heat from the living room to cool down the silicon genuinely gave me chills. It turned routine debugging telemetry into a campfire story—and made me look twice at my terminal before shutting my laptop for the night.
來源:DEV Community · dev.to
