Retention
The cleaner is the one thing in Yoke that deletes what nobody asked it to delete. It bounds the log store per unit, by three limits.
The three limits
| Limit | Default | Bounds |
|---|---|---|
retention.age | 7d | how old an entry may be |
retention.bytes | 50MB | how much a group may hold: each entry's message plus its detail |
retention.entries | 100000 | how many entries a group may hold |
- Each limit is independent, and a limit of zero constrains nothing. Absent takes the default; zero keeps everything.
- Applied in the order age, bytes, count, each pass seeing what the one before it left, oldest first.
- The byte figure undercounts the file: the limit is proportional, not exact.
- The defaults are inherited figures, not measured ones.
The group is the unit
The limits apply per group, and the group is the unit. A deployment of ten units has ten budgets: its nominal ceiling is ten times each limit, not the limit.
- Four copies of one Plugin have four budgets; the copy that prints most spends only its own.
- What belongs to no unit is the group
/core, which takes the deployment's policy and has no override. - Severity is never read. A budget is spent oldest first, whatever each entry was graded.
A group's policy
| Source | Read | Applies to |
|---|---|---|
the description's policy block | once, when it is read | every group, by default |
a unit's own policy block | once, with it | that unit's group |
an override set with unit.retention.set | at every cycle | that unit's group, replacing both — a limit it leaves out is unconstrained |
policy:
retention: { age: 3d, bytes: 20MB }
units:
acquire-1:
kind: plugin
plugin: com.example.acquire
policy: { retention: { entries: 500000 } }
acquire-1 keeps three days, twenty megabytes and five hundred thousand entries; every other group, and
/core, three days, twenty megabytes and a hundred thousand.
When the cleaner runs
| the interval | one hour |
| the first cycle | one interval after startup, plus an offset derived from the instance's name |
VACUUM | once ten thousand deletions have accumulated since the last |
- The offset is the same at every start of an instance and different between instances, so instances started together do not clean together.
- A Core restarted more often than the interval never cleans.
The worst case
The worst case is computed, and never enforced. It is the sum, over one group per declared unit and
/core, of each group's bytes limit, and the Core says it at the start. Where any group's bytes limit
is zero it is unbounded, said as such and with no figure; an unbounded deployment is not refused.