tailer

package
v0.0.0-...-1d9613f Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSleepDuration = 1 * time.Second

DefaultSleepDuration represents the amount of time the tailer waits before reading new data when no data is received

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Path   string
	Source *config.LogSource
}

File represents a file to tail

func NewFile

func NewFile(path string, source *config.LogSource) *File

NewFile returns a new File

type FileProvider

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

FileProvider implements the logic to retrieve at most filesLimit Files defined in sources

func NewFileProvider

func NewFileProvider(sources []*config.LogSource, filesLimit int) *FileProvider

NewFileProvider returns a new FileProvider

func (*FileProvider) FilesToTail

func (p *FileProvider) FilesToTail() []*File

FilesToTail returns all the Files matching paths in sources, it cannot return more than filesLimit Files. For now, there is no way to prioritize specific Files over others, they are just returned in alphabetical order

type Scanner

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

Scanner checks all files provided by fileProvider and create new tailers or update the old ones if needed

func New

func New(sources []*config.LogSource, tailingLimit int, pp pipeline.Provider, auditor *auditor.Auditor, tailerSleepDuration time.Duration) *Scanner

New returns an initialized Scanner

func (*Scanner) Start

func (s *Scanner) Start()

Start starts the Scanner

func (*Scanner) Stop

func (s *Scanner) Stop()

Stop stops the Scanner and its tailers in parallel, this call returns only when all the tailers are stopped

type Tailer

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

Tailer tails one file and sends messages to an output channel

func NewTailer

func NewTailer(outputChan chan message.Message, source *config.LogSource, path string, sleepDuration time.Duration) *Tailer

NewTailer returns an initialized Tailer

func (*Tailer) GetReadOffset

func (t *Tailer) GetReadOffset() int64

GetReadOffset returns the position of the last byte read in file

func (*Tailer) Identifier

func (t *Tailer) Identifier() string

Identifier returns a string that uniquely identifies a source

func (*Tailer) SetDecodedOffset

func (t *Tailer) SetDecodedOffset(off int64)

SetDecodedOffset sets the position of the last byte decoded in the file

func (*Tailer) SetReadOffset

func (t *Tailer) SetReadOffset(off int64)

SetReadOffset sets the position of the last byte read in the file

func (*Tailer) Stop

func (t *Tailer) Stop()

Stop stops the tailer and returns only when the decoder is flushed

func (*Tailer) StopAfterFileRotation

func (t *Tailer) StopAfterFileRotation()

StopAfterFileRotation prepares the tailer to stop after a timeout to finish reading its file that has been log-rotated

Jump to

Keyboard shortcuts

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