logs

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 18 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllLogs

func GetAllLogs(log string) ([]string, error)

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 UncompressLog

func UncompressLog(log string) (_ io.ReadCloser, retErr 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`.

Types

type ContainerLogManager

type ContainerLogManager interface {
	// TODO(random-liu): Add RotateLogs function and call it under disk pressure.
	// Start container log manager.
	Start()
	// Clean removes all logs of specified container.
	Clean(ctx context.Context, containerID string) error
}

ContainerLogManager manages lifecycle of all container logs.

Implementation is thread-safe.

func NewContainerLogManager

func NewContainerLogManager(runtimeService internalapi.RuntimeService, osInterface kubecontainer.OSInterface, maxSize string, maxFiles int, maxWorkers int, monitorInterval metav1.Duration) (ContainerLogManager, error)

NewContainerLogManager creates a new container log manager.

func NewStubContainerLogManager

func NewStubContainerLogManager() ContainerLogManager

NewStubContainerLogManager returns an empty ContainerLogManager which does nothing.

type LogRotatePolicy

type LogRotatePolicy struct {
	// MaxSize in bytes of the container log file before it is rotated. Negative
	// number means to disable container log rotation.
	MaxSize int64
	// MaxFiles is the maximum number of log files that can be present.
	// If rotating the logs creates excess files, the oldest file is removed.
	MaxFiles int
}

LogRotatePolicy is a policy for container log rotation. The policy applies to all containers managed by kubelet.

Jump to

Keyboard shortcuts

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