DEV Community

Cover image for Naplog: let the logs wait
Prince Jain
Prince Jain

Posted on

Naplog: let the logs wait

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission 🦥

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

Naplog turns a pasted batch of log lines into a short morning brief. You paste up to 120 lines, a local open-weight model reads them, and you get back at most five incidents. Every incident links to the exact source lines it claims as evidence, so checking its work takes seconds.

The effort it saves is the 6 a.m. scroll. Anyone who has opened a log file planning to "just skim it" and resurfaced 40 minutes later gets to be a little lazier here: skim five slips, then only read the lines that matter.

Naplog did not exist on October 21. It is two days of work, built inside this challenge window.

Demo

The demo has to run on my machine: the app only binds to 127.0.0.1 and that is the whole point. Here it is working on the bundled 16-line synthetic log:

Naplog demo: paste logs, local model reads them, brief links every claim to its source lines

On that sample, gemma3:4b found all five planted issues (three database connection timeouts, a failed nightly report, a disk-full backup, a rejected auth token) in 127.8 seconds on an M1 Max. Not fast. The model reads slowly so I do not have to read at all.

The repo includes the same sample file and a one-command start if you want to run it on your own logs.

Code

GitHub logo princejain756 / naplog

Local morning briefs from pasted logs via Ollama and Gemma. Every issue links back to its source lines. No cloud inference.

Naplog

A server asleep under a blanket of log lines

Let the logs wait.

Naplog turns a pasted batch of log lines into a short morning brief using a local language model through Ollama. Every issue in the brief links back to the numbered lines it came from, so you can check the evidence before acting. Built for Hacktoberfest 2026, Week 3.

No cloud inference, no accounts, no scheduled jobs. The pasted text never leaves this machine and is held only in memory for the lifetime of the process.

Requirements

  • Node.js 22 or newer (uses only the standard library)

  • Ollama running on this machine

  • The gemma3:4b model pulled locally:

    ollama pull gemma3:4b
    Enter fullscreen mode Exit fullscreen mode

Initial model download needs internet access. After that, inference runs entirely offline.

Run

npm start
Enter fullscreen mode Exit fullscreen mode

Then open http://127.0.0.1:3217. The app listens on loopback only.

Test

npm test
Enter fullscreen mode Exit fullscreen mode

Checks cover input preparation, schema validation, the Ollama request contract (via a stubbed fetch), the HTTP surface, and…

Node 22, standard library only, no dependencies.

How I Built It

All inference runs through Ollama with gemma3:4b, a 3.35 GB open-weight model pulled to local disk. The interesting part is not the prompt. It is the contract around it:

  • contract.json pins the model tag, system prompt, JSON schema, generation options, and limits in one auditable file.
  • Before text reaches the model, common credential shapes (password=, token=, api_key=, secret=, Bearer values) are replaced with [REDACTED].
  • The model answers against a strict schema: at most five incidents, each citing input line numbers. Responses are bounded to 64 KiB and validated; malformed output and failures are never cached.
  • One digest at a time per server. Concurrent calls get HTTP 429 instead of a queue that pretends to scale.
  • Successful digests sit in an 8-entry in-memory cache keyed by content hash.

The server checks Host and Origin headers, serves an explicit static allowlist, sends no-store and CSP headers, and writes nothing to disk. No log bodies, no model output, no analytics.

40 automated checks cover masking, schema validation, the Ollama request shape, the HTTP surface, and the single-inference lock. npm test runs all of them without needing the model.

Honest bits from the build. The Ollama already installed on this machine was too old to even pull gemma3:4b (HTTP 412), so the first hour went to upgrading Ollama, not writing inference code. And in the first live run the model described retry attempts in an observation but cited only the timeout lines as evidence. Legal, since those lines exist, but a good reminder of what the evidence links are: they show where a claim points, they do not prove it. That is why the UI stamps "AI draft. Check the source lines before acting." over the output.

Why Does Open Innovation Matter?

Logs are close to the worst thing you can send to a hosted API. They carry hostnames, internal IPs, user IDs, customer data, and the occasional credential somebody forgot to scrub. A closed endpoint would make this tool a data leak with extra steps.

An open-weight model turns the privacy claim from contractual into structural. Inference happens in a process on my laptop, the model still works with the cable pulled, each run costs $0, and the model is swappable: change one string in contract.json, run the same test suite, and the new model has to satisfy the same schema. Closed APIs deprecate, reprice, and get acquired. A 3.35 GB file on disk just sits there.

The Lazy Payoff

Real numbers from this build: 128 seconds of model time replaces the 10 to 15 minutes I would otherwise spend reading a batch like this carefully. Input is capped at 120 nonblank lines on purpose. The use case is the morning batch, not forensics. If you are pasting 5,000 lines, you are doing the job the tool was built to avoid.

Prize Categories

  • Best Use of Gemma: gemma3:4b performs all inference locally through Ollama.

Top comments (0)