kubernetes/pkg/kubelet/logs/container_log_manager.go

const timestampFormat

const compressSuffix

const tmpSuffix

type ContainerLogManager

type LogRotatePolicy

// GetAllLogs gets all inuse (rotated/compressed) logs for a specific container log.
// Returned logs are sorted in oldest to newest order.
// TODO(#59902): Leverage this function to support log rotation in `kubectl logs`.
func GetAllLogs(log string) ([]string, error) {}

type compressReadCloser

func (rc *compressReadCloser) Close() error {}

// UncompressLog compresses a compressed log and return a readcloser for the
// stream of the uncompressed content.
// TODO(#59902): Leverage this function to support log rotation in `kubectl logs`.
func UncompressLog(log string) (_ io.ReadCloser, retErr error) {}

// parseMaxSize parses quantity string to int64 max size in bytes.
func parseMaxSize(size string) (int64, error) {}

type containerLogManager

// NewContainerLogManager creates a new container log manager.
func NewContainerLogManager(runtimeService internalapi.RuntimeService, osInterface kubecontainer.OSInterface, maxSize string, maxFiles int, maxWorkers int, monitorInterval metav1.Duration) (ContainerLogManager, error) {}

// Start the container log manager.
func (c *containerLogManager) Start() {}

// Clean removes all logs of specified container (including rotated one).
func (c *containerLogManager) Clean(ctx context.Context, containerID string) error {}

func (c *containerLogManager) processQueueItems(ctx context.Context, worker int) {}

func (c *containerLogManager) rotateLogs(ctx context.Context) error {}

func (c *containerLogManager) processContainer(ctx context.Context, worker int) (ok bool) {}

func (c *containerLogManager) rotateLog(ctx context.Context, id, log string) error {}

// cleanupUnusedLogs cleans up temporary or unused log files generated by previous log rotation
// failure.
func (c *containerLogManager) cleanupUnusedLogs(logs []string) ([]string, error) {}

// filterUnusedLogs splits logs into 2 groups, the 1st group is in used logs,
// the second group is unused logs.
func filterUnusedLogs(logs []string) (inuse []string, unused []string) {}

// isInUse checks whether a container log file is still inuse.
func isInUse(l string, logs []string) bool {}

// removeExcessLogs removes old logs to make sure there are only at most MaxFiles log files.
func (c *containerLogManager) removeExcessLogs(logs []string) ([]string, error) {}

// compressLog compresses a log to log.gz with gzip.
func (c *containerLogManager) compressLog(log string) error {}

// rotateLatestLog rotates latest log without compression, so that container can still write
// and fluentd can finish reading.
func (c *containerLogManager) rotateLatestLog(ctx context.Context, id, log string) error {}