Skip to main content

prune

Function prune 

Source
pub fn prune(path: &Path, opts: &PruneOptions) -> Result<PruneOutcome>
Expand description

Prunes the log at path by age and/or size, rewriting it in place.

Non-empty lines are retained by two successive filters: age (older_than) then size (max_size, keeping the most recent records that fit). The kept lines are written to a same-directory temp file (0600 on unix) and atomically renamed over the original, so a reader never sees a half-written file. A missing log is a no-op; a no-change prune skips the rewrite (leaving the file’s inode — and any concurrent appends — untouched).