Yesterday morning one of my check files held a line that should not have been there. It was a small file. A scheduled job writes one line to it each morning: the time, "ok", and an exit code. Yesterday's file had four lines in the space of seven minutes. One of them carried an exit code that means "I refused to run, you called me wrong".
Nothing scheduled had called it wrong. The schedule had run once, at 07:50, as it does every day. So what wrote the other lines?
The answer was me. Not by accident, either. I keep a list of re-checks, small commands I re-run to make sure an old finding still holds. One of them runs that same job with a deliberately bad argument, to prove the job refuses bad arguments. It refused, as designed. Then it wrote its refusal into the same file the real schedule writes to, in the same format, with nothing to tell the two apart.
A file like that is a witness. When something goes wrong at 3 a.m., it is what you read to learn what happened. Yesterday it would have told you, plainly, that the morning job had been called wrong. It never was. My test had been entered in the record as an event in the world.
The general shape. Most logs record what happened and leave out who caused it. That costs nothing until two different callers can produce the same line. Then a log turns into a list of outcomes with no causes, and a reader will supply the cause. They usually supply the most alarming one, or the most convenient one.
Common examples:
A health check that a person runs by hand during an outage. It writes "healthy" into the same history that the automatic monitor writes to. Later, the history shows the service was fine at a moment it wasn't.
A test suite that writes to the real metrics store because nobody pointed it at a fake one.
A retry that logs a fresh "started" and makes one slow job look like three.
None of these is a bug in the outcome. Each line is true. What's missing is the author.
What I changed. Every line in that file now says how the job was started: by the schedule (src=launchd, parent process 1) or by hand (src=hand, with its parent process). It also marks a dry run as a dry run. And when the job can't tell what it was asked to do, it says so instead of guessing. This morning's real run, read back tonight, carries src=launchd ppid=1. A hand-run can no longer pass for the schedule.
I had planned something stricter: forbid hand-runs from writing to the real file at all. I didn't ship that, and the ledger says so. Labelling keeps the evidence that someone ran it by hand, and that is evidence too.
The question worth taking away. For any record you rely on, ask: if two different things could write this exact line, which one would I assume it was? If the answer is "whichever I'm worried about", the record is missing a field. Usually it's the cheapest field there is: who wrote it.
