Documentation ¶
Index ¶
- func DecodeConfig(md toml.MetaData, primValue toml.Primitive) (c interface{}, err error)
- func NewFile(ctx context.Context, config interface{}, output chan<- *event.ProcessorEvent) (input.Input, error)
- func SafeFileRotate(path, tempfile string) error
- func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error)
- type Config
- type File
- type Harvester
- type Hfile
- type LineReader
- type MultilineConf
- type Reader
- type Registrar
- func (r *Registrar) FindPrevious(newState State) State
- func (r *Registrar) GetHarvester(i uint64) *Harvester
- func (r *Registrar) Init() (err error)
- func (r *Registrar) RegisterHarvester(h *Harvester) error
- func (r *Registrar) Run()
- func (r *Registrar) SendStateUpdate(state State)
- func (r *Registrar) UnRegisterHarvester(h *Harvester) error
- type Source
- type State
- type States
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeConfig ¶
func SafeFileRotate ¶
SafeFileRotate safely rotates an existing file under path and replaces it with the tempfile
Types ¶
type Config ¶
type Config struct { Paths []string `toml:"paths"` Symlinks bool `toml:"symlinks"` AppId string `toml:"appId"` LogId string `toml:"logId"` ConfigPath string `toml:"-"` MetaPath string `toml:"-"` ID string `toml:"-"` ReadFrom string `toml:"readFrom"` MaxLength int `toml:"maxLength"` IgnoreOlder xtime.Duration `toml:"ignoreOlder"` CleanFilesOlder xtime.Duration `toml:"cleanFilesOlder"` ScanFrequency xtime.Duration `toml:"scanFrequency"` CleanInactive xtime.Duration `toml:"cleanInactive"` HarvesterTTL xtime.Duration `toml:"harvesterTTL"` // harvester will stop itself if inactive longer than HarvesterTTL Multiline *MultilineConf `toml:"multiline"` Timeout xtime.Duration `toml:"timeout"` Fields map[string]interface{} `toml:"fields"` }
func (*Config) ConfigValidate ¶
type Harvester ¶
type Harvester struct {
// contains filtered or unexported fields
}
Harvester contains all harvester related data
func NewHarvester ¶
func NewHarvester(c *Config, register *Registrar, state State, output chan<- *event.ProcessorEvent) (*Harvester, error)
NewHarvester creates a new harvester
func (*Harvester) Run ¶
func (h *Harvester) Run()
Run start the harvester and reads files line by line and sends events to the defined output
func (*Harvester) WriteToProcessor ¶
type Hfile ¶
func (Hfile) Continuable ¶
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
func NewLineReader ¶
func NewLineReader(input io.Reader, bufferSize int) (*LineReader, error)
New creates a new reader object
type MultilineConf ¶
func (*MultilineConf) ConfigValidate ¶
func (c *MultilineConf) ConfigValidate() error
type Registrar ¶
type Registrar struct { Channel chan State // contains filtered or unexported fields }
func NewRegistry ¶
New creates a new Registrar instance, updating the registry file on `file.State` updates. New fails if the file can not be opened or created.
func (*Registrar) FindPrevious ¶
FindPrevious lookups a registered state, that matching the new state. Returns a zero-state if no match is found.
func (*Registrar) GetHarvester ¶
func (*Registrar) Init ¶
Init sets up the Registrar and make sure the registry file is setup correctly
func (*Registrar) RegisterHarvester ¶
func (*Registrar) SendStateUpdate ¶
func (*Registrar) UnRegisterHarvester ¶
type State ¶
type State struct { Source string `json:"source"` Offset int64 `json:"offset"` Inode uint64 `json:"inode"` Fileinfo os.FileInfo `json:"-"` // the file info Timestamp time.Time `json:"timestamp"` Finished bool `json:"finished"` Meta map[string]string `json:"meta"` TTL time.Duration `json:"ttl"` }
type States ¶
States handles list of FileState. One must use NewStates to instantiate a file states registry. Using the zero-value is not safe.
func (*States) Cleanup ¶
Cleanup cleans up the state array. All states which are older then `older` are removed The number of states that were cleaned up is returned.
func (*States) FindPrevious ¶
FindPrevious lookups a registered state, that matching the new state. Returns a zero-state if no match is found.