tailer

package
v0.0.0-...-5655933 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package tailer provides a class that is responsible for tailing log files and extracting new log lines to be passed into the virtual machines.

Index

Constants

This section is empty.

Variables

View Source
var ErrNilOption = errors.New("nil option supplied")
View Source
var ErrNoLinesChannel = errors.New("Tailer needs a lines channel")
View Source
var ErrUnsupportedURLScheme = errors.New("unsupported URL scheme")
View Source
var OneShot = &niladicOption{func(t *Tailer) error { t.oneShot = true; return nil }}

OneShot puts the tailer in one-shot mode, where sources are read once from the start and then closed.

Functions

This section is empty.

Types

type IgnoreRegex

type IgnoreRegex string

IgnoreRegex sets the regular expression to use to filter away pathnames that match the LogPatterns glob.

type LogPatterns

type LogPatterns []string

LogPatterns sets the glob patterns to use to match pathnames.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures a new Tailer.

func LogPatternPollWaker

func LogPatternPollWaker(w waker.Waker) Option

LogPatternPollWaker triggers polls on the filesystem for new logs that match the log glob patterns.

func LogstreamPollWaker

func LogstreamPollWaker(w waker.Waker) Option

LogstreamPollWaker wakes idle logstreams.

func StaleLogGcWaker

func StaleLogGcWaker(w waker.Waker) Option

StaleLogGcWaker triggers garbage collection runs for stale logs in the tailer.

type Tailer

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

Tailer polls the filesystem for log sources that match given `LogPathPatterns` and creates `LogStream`s to tail them.

func New

func New(ctx context.Context, wg *sync.WaitGroup, lines chan<- *logline.LogLine, options ...Option) (*Tailer, error)

New creates a new Tailer.

func (*Tailer) AddPattern

func (t *Tailer) AddPattern(pattern string) error

AddPattern adds a pattern to the list of patterns to filter filenames against.

func (*Tailer) ExpireStaleLogstreams

func (t *Tailer) ExpireStaleLogstreams() error

ExpireStaleLogstreams removes logstreams that have had no reads for 1h or more.

func (*Tailer) Ignore

func (t *Tailer) Ignore(pathname string) bool

func (*Tailer) Poll

func (t *Tailer) Poll() error

func (*Tailer) PollLogPatterns

func (t *Tailer) PollLogPatterns() error

func (*Tailer) PollLogStreamsForCompletion

func (t *Tailer) PollLogStreamsForCompletion() error

PollLogStreamsForCompletion looks at the existing paths and checks if they're already complete, removing it from the map if so.

func (*Tailer) SetIgnorePattern

func (t *Tailer) SetIgnorePattern(pattern string) error

func (*Tailer) SetOption

func (t *Tailer) SetOption(options ...Option) error

SetOption takes one or more option functions and applies them in order to Tailer.

func (*Tailer) StartLogPatternPollLoop

func (t *Tailer) StartLogPatternPollLoop(waker waker.Waker)

StartLogPatternPollLoop runs a permanent goroutine to poll for new log files.

func (*Tailer) StartStaleLogstreamExpirationLoop

func (t *Tailer) StartStaleLogstreamExpirationLoop(waker waker.Waker)

StartStaleLogstreamExpirationLoop runs a permanent goroutine to expire stale logstreams.

func (*Tailer) TailPath

func (t *Tailer) TailPath(pathname string) error

TailPath registers a filesystem pathname to be tailed.

func (*Tailer) WriteStatusHTML

func (t *Tailer) WriteStatusHTML(w io.Writer) error

WriteStatusHTML emits the Tailer's state in HTML format to the io.Writer w.

Directories

Path Synopsis
Package logstream provides an interface and implementations of log source streaming.
Package logstream provides an interface and implementations of log source streaming.

Jump to

Keyboard shortcuts

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