logrotate

package
v0.0.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package logrotate implements a remediation-mode log truncation builtin.

logrotate — truncate logs by size threshold or force

Usage: logrotate (-s SIZE|-f) [OPTION]... FILE...

This is a deliberately small, rshell-safe subset inspired by logrotate(8). It truncates each FILE to zero bytes through the AllowedPaths sandbox. It does not parse logrotate config files, rename logs, retain rotated copies, compress output, write state files, run pre/post-rotate scripts, or follow symlinked write targets.

Accepted flags:

-s SIZE, --size=SIZE
    Only truncate files whose current size is at least SIZE bytes. SIZE
    uses the same non-negative coreutils suffix grammar as truncate -s.

-f, --force
    Truncate without a size threshold. Mutually exclusive with --size.

-n, --dry-run
    Print what would happen without modifying files. Dry-run implies
    per-file reporting even when --verbose is not set.

-v, --verbose
    Print a line per file describing whether it was truncated or skipped.

-h, --help
    Print usage to stdout and exit 0.

Exit codes:

0  All files processed successfully.
1  Bad flag value, missing operand, or at least one per-file failure.
   Processing continues across operands so a single failure does not
   abort the run.

Index

Constants

This section is empty.

Variables

View Source
var Cmd = builtins.Command{
	Name:            "logrotate",
	Description:     "truncate logs by size threshold or force",
	MakeFlags:       registerFlags,
	RemediationOnly: true,
}

Cmd is the logrotate builtin command descriptor.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL