What this is about
Anyone who runs a site wants to know if people visit it. There are two common ways to find out. One is to load a script from an analytics company into every page, so your browser reports back. The other is to read what your own server already saw. We use the second way. This article explains what a server log is, what we keep, how long, and what it cannot tell us.
Why it matters
How a site counts visitors says a lot about how it treats them. A script from another company sends data off to a place you do not control. A short, plain log on your own machine keeps the data at home and is easier to explain. For anyone who runs a small site, it is also much simpler and lighter to run.
How it works
What a server sees anyway
Every time a browser asks for a page, the server receives a request. It knows the time, the address that was asked for, the answer it gave, and the network address the request came from. It has to know these things to do its job, and to spot abuse. A request log is just a record of this.
Our own log
In our base template, the app writes a first party request log into its own database. The code says it is a security and operational access log. Its legal footing, as the comment puts it, depends on being kept for a short time and used for a limited purpose.
A few details from the code:
- Requests to internal paths and to static files are skipped.
- The default retention is 30 days. The owner can change it in the admin settings.
- A daily timer on the server deletes rows older than the retention window. The comment in the timer's file explains why: the setting alone is only a promise, so the timer enforces it.
- A page for the admin shows traffic based on this log.
Anonymous visitors are not rebuilt into histories
This is a design choice written into the code. The log is not used to reconstruct what an anonymous visitor did across many visits. If you are signed in, your rows are connected to your account, because the privacy policy says that is what happens when you are signed in. The same rows appear in the export of your own data. They reach back no further than the retention window.
Why not an analytics tool
We tried one. It was a self hosted analytics tool that does not use cookies, and it worked as promised. It also needed a second database and a fair amount of memory, and we found it too heavy for what we needed, and removed it. We do not claim that it was a bad tool. We claim it was the wrong size for us.
The code comment points out a real difference between the two designs. An analytics tool of that kind scrambles the visitor's network address with a value that changes daily, so it can never keep a trail of one visitor. That is the whole point of it. A server log is a different system with a different purpose and a different legal basis. Mixing them up would be a mistake.
What the log shows
- Which pages are asked for, and how often.
- Which paths return errors, such as a 404 for a link that is broken.
- Spikes of requests that look like abuse.
- Rough counts of visits by day.
What the log cannot show
- Who a visitor is. It sees a network address, which may be shared by many people at one office or by one person across many.
- How long someone stayed or what they read. A log sees requests, not attention.
- Robots versus people. Many requests come from programs. They are in the log too.
- Pages that were served from a cache before they reached us. A copy at a content network never shows up in our log.
So when we say a page had so many hits, we mean requests that reached our server. That is a useful number and it is not a head count of readers.
A habit that helps
Whatever you choose, write down what you collect and for how long, in plain words, on a page that visitors can find. Then make a machine enforce it, so the promise does not depend on memory. For us, that is a timer that deletes old rows each day. If you cannot explain a data source to a visitor in two sentences, that is a sign you may not need it.
Words you may not know
- Server log: a record of the requests a server received.
- Request: a message from a browser asking for a page or file.
- Retention: how long data is kept before it is deleted.
- First party: run by the site itself, not by another company.
- Tracking script: a piece of code in a page that reports your visit elsewhere.
- Network address: the number that identifies a connection on the internet.
- Purge: delete old records on a schedule.
Try it
- Read what we say we keep, in our privacy policy.
- In your browser's developer tools on amarbaro.com, look at the Network tab. Check which requests go to other companies. For our pages, you should see our own domain.
- If you run a site, find your own server's access log and count the five most requested paths.
- See the sites we run at amarbaro.com/web.
Read next
- A Reboot Is Not a Health Check: another use of what a server can see about itself.

Commenti
Ancora nessun commento.
Accedi per commentare.