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
keep=14— how many days of files to keepip=off— write-instead of the connecting address (for a server that visitors reach directly)max_mb=12— one day's file stops growing at this size;max_total_mb=64— all files together;min_free_mb=32— logging stops while less than this is free on the disk- Restart the server after a change (
service web restart, or stop and start thehttpdline).
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.\xHHescapes 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-ForandCF-Connecting-IPare 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 undermax_total_mb(oldest days go first, checked at each midnight); undermin_free_mbfree 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
- What it keeps: for each request, the time, the request line (method, path and query string), the answer code, the number of bytes, the page the visitor came from (the Referer header) and the browser's name (User-Agent). It also keeps the address that connected to the server. On nanumos.com that address is Cloudflare's, not the visitor's, because every visit comes through Cloudflare; the visitor's own address is never read. On a server that visitors reach directly it is the visitor's address — set
ip=offthere and the log writes-. - What it does not keep: the visitor's own address behind a proxy (
X-Forwarded-For,CF-Connecting-IP), cookies, request bodies, passwords, file contents. - For how long: 14 days (
keep=), then the files are deleted. The counters forhttpd statslive in memory for 24 hours.
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