gatherlogs

package
v0.0.0-...-7cac148 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultLogLines = 500000

DefaultLogLines in the default number of log lines we should ingest from journald.

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleInfo

type BundleInfo struct {
	Checksum string
	Name     string
	Path     string
	Size     int64
}

BundleInfo is a type for a bundle's information

func NewBundleInfo

func NewBundleInfo(bundlePath string) (BundleInfo, error)

NewBundleInfo extrapolates information about bundle from its path

type Command

type Command struct {
	Name          string   // friendly name (used for uniq ref, file name, etc)
	Cmd           string   // command to run
	Args          []string // arguments to the command
	OutputHandler func() (io.WriteCloser, error)
}

Command represents a system command

type Copy

type Copy struct {
	SrcPath  string
	DestPath string
}

Copy holds the fetching data

type Gatherer

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

Gatherer defines values used in the log/data collection process

func NewGatherer

func NewGatherer(stagingDir, archiveRoot, fqdn string, now time.Time) *Gatherer

NewGatherer returns an initialized Gatherer

func (*Gatherer) AddCommand

func (g *Gatherer) AddCommand(name, cmd string, args ...string)

AddCommand loads a new command into our list of commands to run

func (*Gatherer) AddCopiesFromPath

func (g *Gatherer) AddCopiesFromPath(fileName, path string)

AddCopiesFromPath finds files matching a given name under a given path, and adds them as copy operations

func (*Gatherer) AddCopy

func (g *Gatherer) AddCopy(srcPath string)

AddCopy adds a copy operation for a given path

func (*Gatherer) AddOther

func (g *Gatherer) AddOther(name string, execFunc func() ([]byte, error))

AddOther adds a generic operation to the list of gatherers

func (*Gatherer) AddTail

func (g *Gatherer) AddTail(srcPath string, maxLines uint64)

func (*Gatherer) AddURL

func (g *Gatherer) AddURL(name, url string)

AddURL adds an operation to fetch output from a given URL

func (*Gatherer) CreateBundleDir

func (g *Gatherer) CreateBundleDir() error

CreateBundleDir will create the full path (mkdir -p) to the directory where all of the data will be collected for this run of the log gatherer

func (*Gatherer) CreateBundleFile

func (g *Gatherer) CreateBundleFile() (BundleInfo, error)

CreateBundleFile creates a compressed archive (currently tar/gzip) of all the data collected on this run

func (*Gatherer) ExecuteAll

func (g *Gatherer) ExecuteAll()

ExecuteAll executes all of the operations

func (*Gatherer) FetchHostname

func (g *Gatherer) FetchHostname(args ...string) string

FetchHostname - Get the hostname for the currently running machine

func (*Gatherer) FindFilesToCopy

func (g *Gatherer) FindFilesToCopy(path, name string) []string

FindFilesToCopy find files under a given path

type Other

type Other struct {
	Name          string
	ExecFunc      func() ([]byte, error)
	OutputHandler func() (io.WriteCloser, error)
}

Other holds the fetching data

type Tail

type Tail struct {
	SrcPath  string
	DestPath string
	Lines    uint64
}

type URL

type URL struct {
	Name          string
	URL           string
	OutputHandler func() (io.WriteCloser, error)
}

URL holds the fetching data

Jump to

Keyboard shortcuts

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