tailer

package
v3.0.0-rc9+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 15 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 (
	LogCount     = expvar.NewInt("log_count")
	LogErrors    = expvar.NewMap("log_errors_total")
	LogRotations = expvar.NewMap("log_rotations_total")
)

Functions

This section is empty.

Types

type LogLine

type LogLine struct {
	Filename string // The log filename that this line was read from
	Line     string // The text of the log line itself up to the newline.
}

LogLine contains all the information about a line just read from a log.

func NewLogLine

func NewLogLine(filename string, line string) *LogLine

NewLogLine creates a new LogLine object.

type Options

type Options struct {
	Lines   chan<- *LogLine // output channel of lines read
	OneShot bool            // if true, reads from start and exits after each file hits eof
	W       watcher.Watcher
	FS      afero.Fs
}

Options configures a Tailer

type Tailer

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

Tailer receives notification of changes from a Watcher and extracts new log lines from files. It also handles new log file creation events and log rotations.

func New

func New(o Options) (*Tailer, error)

New returns a new Tailer, configured with the supplied Options

func (*Tailer) Close

func (t *Tailer) Close() error

Close signals termination to the watcher.

func (*Tailer) Tail

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

Tail registers a pattern to be tailed. If pattern is a plain file then it is watched for updates and opened. If pattern is a glob, then all paths that match the glob are opened and watched, and the directories containing those matches, if any, are watched.

func (*Tailer) TailFile

func (t *Tailer) TailFile(f afero.File) error

TailFile registers a file handle to be tailed. There is no filesystem to watch, so no watches are registered, and no file paths are opened.

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

Jump to

Keyboard shortcuts

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