Documentation
¶
Index ¶
Constants ¶
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 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
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 ¶
GetReadOffset returns the position of the last byte read in file
func (*Tailer) Identifier ¶
Identifier returns a string that uniquely identifies a source
func (*Tailer) SetDecodedOffset ¶
SetDecodedOffset sets the position of the last byte decoded in the file
func (*Tailer) SetReadOffset ¶
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