harvester

package
v5.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

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 MatchAnyRegexps

func MatchAnyRegexps(regexps []*regexp.Regexp, text string) bool

MatchAnyRegexps checks if the text matches any of the regular expressions

Types

type Harvester

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

func NewHarvester

func NewHarvester(
	cfg *common.Config,
	state file.State,
	prospectorChan chan *input.Event,
	done chan struct{},
) (*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

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
Package reader provides interface and struct to read messages and report them to a harvester

Jump to

Keyboard shortcuts

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