Documentation ¶
Overview ¶
Package log harvests different inputs for new information. Currently two harvester types exist:
log
stdin
The log harvester reads a file line by line. In case the end of a file is found with an incomplete line, the line pointer stays at the beginning of the incomplete line. As soon as the line is completed, it is read and returned.
The stdin harvesters reads data from stdin.
Index ¶
Constants ¶
const ( ScanOrderAsc = "asc" ScanOrderDesc = "desc" ScanSortNone = "" ScanSortModtime = "modtime" ScanSortFilename = "filename" )
Contains available scan options
Variables ¶
var ( ErrFileTruncate = errors.New("detected file being truncated") ErrRenamed = errors.New("file was renamed") ErrRemoved = errors.New("file was removed") ErrInactive = errors.New("file inactive") ErrClosed = errors.New("reader closed") )
var ValidScanOrder = map[string]struct{}{ ScanOrderAsc: {}, ScanOrderDesc: {}, }
ValidScanOrder of valid scan orders
var ValidScanSort = map[string]struct{}{ ScanSortNone: {}, ScanSortModtime: {}, ScanSortFilename: {}, }
ValidScanOrder of valid scan orders
Functions ¶
func NewProspector ¶
func NewProspector( cfg *common.Config, outlet channel.Factory, context prospector.Context, ) (prospector.Prospectorer, error)
NewProspector instantiates a new Log
Types ¶
type File ¶
func (File) Continuable ¶
type FileSortInfo ¶
type FileSortInfo struct {
// contains filtered or unexported fields
}
type Harvester ¶
type Harvester struct {
// contains filtered or unexported fields
}
Harvester contains all harvester related data
func NewHarvester ¶
func NewHarvester( config *common.Config, state file.State, states *file.States, publishState func(*util.Data) bool, outlet channel.Outleter, ) (*Harvester, error)
NewHarvester creates a new harvester
func (*Harvester) ID ¶
func (h *Harvester) ID() uuid.UUID
ID returns the unique harvester identifier
func (*Harvester) Run ¶
Run start the harvester and reads files line by line and sends events to the defined output
func (*Harvester) SendStateUpdate ¶
func (h *Harvester) SendStateUpdate()
SendStateUpdate send an empty event with the current state to update the registry close_timeout does not apply here to make sure a harvester is closed properly. In case the output is blocked the harvester will stay open to make sure no new harvester is started. As soon as the output becomes available again, the finished state is written and processing can continue.
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log contains all log related data
type LogConfig ¶
type LogConfig struct { Backoff time.Duration `config:"backoff" validate:"min=0,nonzero"` BackoffFactor int `config:"backoff_factor" validate:"min=1"` MaxBackoff time.Duration `config:"max_backoff" validate:"min=0,nonzero"` CloseInactive time.Duration `config:"close_inactive"` CloseRemoved bool `config:"close_removed"` CloseRenamed bool `config:"close_renamed"` CloseEOF bool `config:"close_eof"` CloseTimeout time.Duration `config:"close_timeout" validate:"min=0"` }
type Pipe ¶
restrict file to minimal interface of FileSource to prevent possible casts to additional interfaces supported by underlying file
func (Pipe) Continuable ¶
type Prospector ¶
type Prospector struct {
// contains filtered or unexported fields
}
Prospector contains the prospector and its config
func (*Prospector) Stop ¶
func (p *Prospector) Stop()
Stop stops all harvesters and then stops the prospector
func (*Prospector) Wait ¶
func (p *Prospector) Wait()
Wait waits for the all harvesters to complete and only then call stop