Documentation
¶
Index ¶
- Constants
- func JournalctlGetLogsCmd(name, destDir string, since, until time.Time) string
- type Commander
- type Copier
- type HTTPer
- type Runner
- type Seeker
- func Exclude(excludes []string, seekers []*Seeker) ([]*Seeker, error)
- func JournaldGetter(name, destDir string, since, until time.Time) *Seeker
- func NewCommander(command string, format string) *Seeker
- func NewCopier(path, destDir string, since, until time.Time) *Seeker
- func NewHTTPer(client *client.APIClient, path string) *Seeker
- func NewSheller(command string) *Seeker
- func Select(selects []string, seekers []*Seeker) ([]*Seeker, error)
- type Sheller
Constants ¶
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 ¶
Types ¶
type Commander ¶
type Commander struct { Command string `json:"command"` // contains filtered or unexported fields }
Commander runs shell commands.
type Copier ¶
type Copier struct { SourceDir string `json:"source_directory"` Filter string `json:"filter"` DestDir string `json:"destination_directory"` Since time.Time `json:"since"` Until time.Time `json:"until"` }
Copier copies files to temp dir based on a filter.
type Runner ¶
type Runner interface {
Run() (interface{}, error)
}
Runner runs things to get information.
type Seeker ¶
type Seeker struct { Runner Runner `json:"runner"` Identifier string `json:"-"` Result interface{} `json:"result"` ErrString string `json:"error"` // this simplifies json marshaling Error error `json:"-"` }
Seeker seeks information via its Runner then stores the results.
func Exclude ¶
Exclude takes a slice of matcher strings and a slice of seekers. If any of the seeker identifiers match the exclude according to filepath.Match() then it will not be present in the returned seeker slice. NOTE(mkcp): This is precisely identical to Select() except we flip the match check. Maybe we can perform both rounds
of filtering in one pass one rather than iterating over all the seekers several times. Not likely to be a huge speed increase though... we're not even remotely bottlenecked on seeker filtering.
func JournaldGetter ¶ added in v0.2.0
JournaldGetter 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
func NewCommander ¶
NewCommander provides a Seeker for running shell commands.
func NewSheller ¶
NewSheller provides a Seeker for running shell commands.