Skip to content

Real-Time Mode

Outcome: you know what GoAccess's real-time mode does, how it is wired, and — plainly — that this chapter is documented, not run: the lab had no browser to point at it, so nothing here is presented as a result.

What it is

Every mode so far writes a snapshot: the log as it stood when the run started. With --real-time-html, GoAccess stays running. It watches the log file, parses new lines as the server appends them, and pushes the updated panels to any browser showing the report — the dashboard as a living page, refreshing itself within about a second of each new request.

# Documented command — NOT run in this guide's lab
goaccess access.log --log-format=COMBINED \
  -o report.html --real-time-html

Serving that page takes a small web server of its own (the report references its live data feed), and the updates travel over a WebSocket: a persistent connection between GoAccess and the browser, distinct from the ordinary request–answer rhythm of the web. The option family around it, from the program's help (transcript t01-help.txt), tells the wiring story:

  • --port and --addr — where the WebSocket server listens
  • --ws-url — the address browsers should connect back to, when it differs from the page's own address (behind a proxy, it will)
  • --ssl-cert and --ssl-key — TLS for the socket, using the OpenSSL support this build carries
  • --daemonize, --pid-file, --fifo-in / --fifo-out — running it as a background service, fed by pipe

Why the lab left it unrun

The mode's entire value is in the watching: a page changing as traffic arrives. The lab could start the server and confirm a socket listens — it could even fetch the page's HTML with curl — but it could not see an update land, and a screenshot-shaped claim it cannot check is exactly what this series does not print. The honest version of this chapter is therefore the map, not the territory: what the mode is, what it needs, and how to know whether your own run of it works.

Checking your own run

If you set it up — on a machine with a browser, it is an evening's small project — the checks write themselves from the rest of this guide:

  1. Generate the static report first (chapter 6) and note its totals.
  2. Start real-time mode on the same log. The page's opening numbers should match the static ones: same counts, live delivery.
  3. Make one request to your server — a page only you would ask for, with a distinctive name. Within a second or so it should appear in the requested files (or, if you invented a missing name, the not-found panel).
  4. If the page loads but never updates, the WebSocket is the suspect: the --ws-url must be an address the browser can reach, which is the classic failure when GoAccess sits behind a proxy or a container boundary.

One caution that carries over from chapter 1 with interest: a real-time page is a live feed of your visitors' activity. Put it behind the same sign-in protection as any admin page — the Authelia guide in this series is the neighbours' chapter's pointer — and never on a public address by accident.