NanumOS

Web server log — who asked for what

What it is

The NanumOS web server (httpd) keeps a visitors' notebook: one line per request — when, which page, what answer, how many bytes. It is the same notebook format nginx and Apache keep, so the usual tools (GoAccess, grep, awk) read it. The notebook is meant for the person who runs the site: "is it up, what is missing, what is slow". Old pages of the notebook are packed away after a day and thrown out after 14 days.

What to do now: on a server edition it is already on. Type httpd stats to see the last hour and the last day.

How to use it

Turn it on, off, or change it

Read the log

See the numbers

httpd stats prints, for the last hour and the last 24 hours: requests, answers by class (2xx, 3xx, 4xx, 5xx), bytes, the 4xx and 5xx counts, the ten most asked paths (query strings dropped), and how long the first byte took (p50 and p95, as "at most N ms").

Check it

Zeus's check (/doctor) has a "Web server (httpd)" row: healthy while the status is fresh and server errors (5xx) stay under 5 % of the day's requests; caution when the log stopped (disk low or the day's file at its size limit) or over half of the requests were 4xx; fault when the status stops changing (the server stopped) or 5xx reach 5 %.

How it works

The server writes each finished request into a small buffer in memory and writes the buffer to the file every few seconds (or when it is nearly full) — never one disk write per request, so the log costs almost nothing. At midnight UTC it closes the day's file, packs every older day with gzip, and removes what is older than the newest 14 days. With the log on, it also writes every 30 seconds a small status file (/tmp/httpd.status) with its counters (without the log there is no status file, so httpd stats and the check have nothing to read); httpd stats and the check read that, and the log.

Technical details
  • Format: Apache/nginx "combined", time always +0000. \xHH escapes for quotes, backslashes and control bytes in the request line, referrer and user agent.
  • The address field is the TCP peer exactly as it connected. X-Forwarded-For and CF-Connecting-IP are never read or written. Behind Cloudflare the peer is always a Cloudflare edge address, so no visitor address is stored.
  • Buffer 16 KiB, written at the latest 5 s after a request; a server killed with Ctrl-C can lose the last 5 s of lines. Rotation takes a moment (the gzip of one day's file) while the server keeps accepting.
  • Size limits: a day's file stops at max_mb (one warning, resumes next day); all files together stay under max_total_mb (oldest days go first, checked at each midnight); under min_free_mb free space (read from the kernel's /proc/storage) logging stops with one warning and resumes by itself when twice that is free.
  • The first-byte time is from "request header complete" to "first byte written", counted in 13 buckets (1 ms ... 5 s) in memory per 10 minutes for 24 hours — so p50/p95 are bucket edges and restart with the server.
  • Developer notes: user/cmds/httplog.h, tests/test_httplog.py, tests/httpd.py.

What this server takes

Frequently asked

Why is every address the same? Because the server sits behind Cloudflare: the address is Cloudflare's. That is on purpose — it keeps your visitors' addresses out of the notebook.

**Why does httpd stats say "memory counters"?** The log had no lines in the window (log off, or a fresh start), so it shows what the server counted since it started.

NanumOS 0.1.8349 · 2026-11-16