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 ¶
- Variables
- type IgnoreRegex
- type LogPatterns
- type Option
- type Tailer
- func (t *Tailer) AddPattern(pattern string) error
- func (t *Tailer) ExpireStaleLogstreams() error
- func (t *Tailer) Ignore(pathname string) bool
- func (t *Tailer) Poll() error
- func (t *Tailer) PollLogPatterns() error
- func (t *Tailer) PollLogStreamsForCompletion() error
- func (t *Tailer) SetIgnorePattern(pattern string) error
- func (t *Tailer) SetOption(options ...Option) error
- func (t *Tailer) StartLogPatternPollLoop(waker waker.Waker)
- func (t *Tailer) StartStaleLogstreamExpirationLoop(waker waker.Waker)
- func (t *Tailer) TailPath(pathname string) error
- func (t *Tailer) WriteStatusHTML(w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
var ErrNilOption = errors.New("nil option supplied")
var ErrNoLinesChannel = errors.New("Tailer needs a lines channel")
var ErrUnsupportedURLScheme = errors.New("unsupported URL scheme")
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 ¶
LogPatternPollWaker triggers polls on the filesystem for new logs that match the log glob patterns.
func LogstreamPollWaker ¶
LogstreamPollWaker wakes idle logstreams.
func StaleLogGcWaker ¶
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 ¶
AddPattern adds a pattern to the list of patterns to filter filenames against.
func (*Tailer) ExpireStaleLogstreams ¶
ExpireStaleLogstreams removes logstreams that have had no reads for 1h or more.
func (*Tailer) PollLogPatterns ¶
func (*Tailer) PollLogStreamsForCompletion ¶
PollLogStreamsForCompletion looks at the existing paths and checks if they're already complete, removing it from the map if so.
func (*Tailer) SetIgnorePattern ¶
func (*Tailer) SetOption ¶
SetOption takes one or more option functions and applies them in order to Tailer.
func (*Tailer) StartLogPatternPollLoop ¶
StartLogPatternPollLoop runs a permanent goroutine to poll for new log files.
func (*Tailer) StartStaleLogstreamExpirationLoop ¶
StartStaleLogstreamExpirationLoop runs a permanent goroutine to expire stale logstreams.