log

package
v0.5.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const JournaldTimeLayout = "2006-01-02 15:04:05"

JournaldTimeLayout custom go time layouts must match the reference time Jan 2 15:04:05 2006 MST

Variables

This section is empty.

Functions

func DockerLogCmd

func DockerLogCmd(container, destDir string, since time.Time) string

Types

type ContainerNotFoundError added in v0.5.0

type ContainerNotFoundError struct {
	// contains filtered or unexported fields
}

func (ContainerNotFoundError) Error added in v0.5.0

func (e ContainerNotFoundError) Error() string

type Docker

type Docker struct {

	// Container is the name of the docker container to get logs from
	Container string `json:"container"`
	// DestDir is the directory we will write the logs to
	DestDir string `json:"destDir"`
	// Since marks the beginning of the time range to include logs
	Since time.Time `json:"since"`
	// Redactions includes any redactions to apply to the output of the runner.
	Redactions []*redact.Redact `json:"redactions"`
	// Timeout specifies the amount of time that the runner should be allowed to execute before cancellation.
	Timeout runner.Timeout `json:"timeout"`
	// contains filtered or unexported fields
}

Docker allows logs to be retrieved for a docker container

func NewDocker

func NewDocker(cfg DockerConfig) *Docker

NewDocker returns a runner with an identifier and fully configured docker runner

func NewDockerWithContext added in v0.5.0

func NewDockerWithContext(ctx context.Context, cfg DockerConfig) *Docker

NewDockerWithContext returns a runner with an identifier and fully configured docker runner, which includes a provided context.

func (Docker) ID

func (d Docker) ID() string

func (Docker) Run

func (d Docker) Run() op.Op

Run executes the runner

type DockerConfig added in v0.5.0

type DockerConfig struct {
	// Container is the name of the docker container to get logs from
	Container string
	// DestDir is the directory we will write the logs to
	DestDir string
	// Since marks the beginning of the time range to include logs
	Since time.Time
	// Redactions includes any redactions to apply to the output of the runner.
	Redactions []*redact.Redact
	// Timeout specifies the amount of time that the runner should be allowed to execute before cancellation.
	Timeout time.Duration
}

type DockerNoLogsError

type DockerNoLogsError struct {
	// contains filtered or unexported fields
}

func (DockerNoLogsError) Error

func (e DockerNoLogsError) Error() string

type DockerNotFoundError

type DockerNotFoundError struct {
	// contains filtered or unexported fields
}

func (DockerNotFoundError) Error

func (e DockerNotFoundError) Error() string

func (DockerNotFoundError) Unwrap

func (e DockerNotFoundError) Unwrap() error

type Journald

type Journald struct {
	Service string    `json:"service"`
	DestDir string    `json:"destDir"`
	Since   time.Time `json:"since"`
	Until   time.Time `json:"until"`
	// Redactions includes any redactions to apply to the output of the runner.
	Redactions []*redact.Redact `json:"redactions"`
	// Timeout specifies the amount of time that the runner should be allowed to execute before cancellation.
	Timeout runner.Timeout `json:"timeout"`
	// contains filtered or unexported fields
}

func NewJournald

func NewJournald(cfg JournaldConfig) *Journald

NewJournald sets the defaults for the journald runner

func NewJournaldWithContext added in v0.5.0

func NewJournaldWithContext(ctx context.Context, cfg JournaldConfig) *Journald

NewJournaldWithContext sets the defaults for the journald runner, including a context.

func (Journald) ID

func (j Journald) ID() string

func (Journald) LogsCmd

func (j Journald) LogsCmd() string

LogsCmd arranges the params into a runnable command string.

func (Journald) Run

func (j Journald) Run() op.Op

Run attempts to pull logs from journald via shell command, e.g.: journalctl -x -u {name} --since '3 days ago' --no-pager > {destDir}/journald-{name}.log

type JournaldConfig added in v0.5.0

type JournaldConfig struct {
	Service string
	DestDir string
	Since   time.Time
	Until   time.Time
	// Redactions includes any redactions to apply to the output of the runner.
	Redactions []*redact.Redact
	// Timeout specifies the amount of time that the runner should be allowed to execute before cancellation.
	Timeout time.Duration
}

type JournaldNotFound

type JournaldNotFound struct {
	// contains filtered or unexported fields
}

func (JournaldNotFound) Error

func (e JournaldNotFound) Error() string

func (JournaldNotFound) Unwrap

func (e JournaldNotFound) Unwrap() error

type JournaldPermissionError

type JournaldPermissionError struct {
	// contains filtered or unexported fields
}

func (JournaldPermissionError) Error

func (e JournaldPermissionError) Error() string

func (JournaldPermissionError) Unwrap

func (e JournaldPermissionError) Unwrap() error

type JournaldServiceNotEnabled

type JournaldServiceNotEnabled struct {
	// contains filtered or unexported fields
}

func (JournaldServiceNotEnabled) Error

func (JournaldServiceNotEnabled) Unwrap

func (e JournaldServiceNotEnabled) Unwrap() error

Jump to

Keyboard shortcuts

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