harvester

package
v5.6.14+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: Apache-2.0 Imports: 21 Imported by: 935

Documentation

Overview

Package harvester 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

This section is empty.

Variables

View Source
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")
)

Functions

func MatchAny

func MatchAny(matchers []match.Matcher, text string) bool

MatchAny checks if the text matches any of the regular expressions

Types

type Harvester

type Harvester struct {
	ID uuid.UUID
	// contains filtered or unexported fields
}

func NewHarvester

func NewHarvester(
	cfg *common.Config,
	state file.State,
	outlet *channel.Outlet,
) (*Harvester, error)

func (*Harvester) Harvest

func (h *Harvester) Harvest(r reader.Reader)

Harvest reads files line by line and sends events to the defined output

func (*Harvester) Setup

func (h *Harvester) Setup() (reader.Reader, error)

Setup opens the file handler and creates the reader for the harvester

func (*Harvester) Stop

func (h *Harvester) Stop()

Stop stops harvester and waits for completion

type LogFile

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

func NewLogFile

func NewLogFile(
	fs source.FileSource,
	config harvesterConfig,
) (*LogFile, error)

func (*LogFile) Close

func (r *LogFile) Close()

func (*LogFile) Read

func (r *LogFile) Read(buf []byte) (int, error)

Read reads from the reader and updates the offset The total number of bytes read is returned.

Directories

Path Synopsis
Package reader provides interface and struct to read messages and report them to a harvester The interface used is: type Reader interface { Next() (Message, error) } Each time Next is called on a reader, a Message object is returned.
Package reader provides interface and struct to read messages and report them to a harvester The interface used is: type Reader interface { Next() (Message, error) } Each time Next is called on a reader, a Message object is returned.

Jump to

Keyboard shortcuts

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