CLI command

skarbiec audit rotate

Close the open audit segment now, rather than at the first entry of the next UTC day.

Invocation#

Shell
skarbiec audit rotate

Purpose#

Close the open audit segment now, rather than at the first entry of the next UTC day.

Required inputs and options#

  • No positional input or option.

Output and state effects#

  • Under the journal's append lock, renames the open file into <journal>.d/ as the next numbered segment (000000.jsonl, 000001.jsonl, …), makes it read-only for the owner, and writes the audit-segment-closed line that opens the new file: its prev is the closed segment's last hash and its extra names the segment, its bytes and that hash. Nothing is copied or rewritten, so a journal written before segments existed becomes 000000.jsonl as it is. Prints rotated true and closed (segment, bytes, last_hash, why and the closing line's hash), or rotated false and the reason when the open file holds no entry, or none beyond the line that closed the segment before it. Every append closes the open file the same way when it began on an earlier UTC day, and first writes the closing line of a close that stopped after its rename.

Refusals#

  • A journal or segment directory this user cannot read or write fails naming the path and the permission it needs; a next segment number that already holds a file is refused naming it, and the open file is not moved over it; a rename across file systems fails naming both paths.