How tamper-evident logs work: hash chains, signatures and trusted time
A plain-language tour of the building blocks behind logs that show when they have been changed, and an honest list of what they still cannot tell you.
A log that stops looks the same as a system with nothing to do. Dead man's switches, heartbeats and other ways to make silence visible.
The most awkward hole in any log is not a changed line. It is a missing stretch of time.
The record shows nothing on Wednesday afternoon. Did nothing happen? Did the service crash? Did a deploy remove the logging code? From the log alone you cannot tell, because silence is just the absence of lines. Monitoring people know this as the "no data" problem, and it has a classic answer.
A recorder that lives inside the thing it records has a conflict of interest. If the application's own code sends the logs, then removing that code, crashing the process, filling the disk or losing the network all produce the same result: nothing arrives, and nothing says so.
The usual failure is boring, not malicious. A config change drops a log level. An exporter's queue overflows. A library upgrade renames a field and the pipeline discards what it cannot parse. Weeks later someone wants the data and it is not there.
Train drivers once had a pedal that had to be held down. If the driver stopped holding it, the train braked. The same idea applies here: do not wait for an event that says "something is wrong", expect a signal that says "everything is fine" and treat its absence as the alarm.
In practice: the monitored component sends a small heartbeat at a fixed interval, and a separate watcher raises an alert if none arrives within a window (two or three intervals, so that a single lost packet does not wake anyone). The watcher must live outside the thing it watches, or it fails together with it. Tools like Prometheus (the absent() function, or alerting on up == 0), Healthchecks-style ping URLs and cloud monitors all implement this.
Alerting tells you now. For audits you also want the gap to be on the record afterwards. If the watcher writes an entry of its own ("no heartbeat since 14:07"), dated at the last signal it heard, then the missing stretch has a start time written down by someone other than the component that went quiet. If that log is tamper-evident (see how tamper-evident logs work), nobody can quietly delete the entry later either.
Be careful about what you conclude from a good heartbeat.
If someone says their logs are complete, ask how they know. A log can show that what it holds is unchanged. Whether it holds everything depends on the pipeline that feeds it, which is a separate property and needs its own checks. The cheapest improvement is the one above: make silence loud, and put the alarm outside the thing that might fail. The wider case for evidence you do not have to take on trust is in why ordinary logs are not evidence.