harvester

package
v6.0.0-alpha2+incompat... Latest Latest
Warning

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

Go to latest
Published: May 31, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogType   = "log"
	StdinType = "stdin"
	RedisType = "redis"
)

Contains available prospector types

Variables

View Source
var ValidType = map[string]struct{}{
	StdinType: {},
	LogType:   {},
	RedisType: {},
}

ValidType of valid input types

Functions

func MatchAny

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

MatchAny checks if the text matches any of the regular expressions

Types

type Forwarder

type Forwarder struct {
	Config     ForwarderConfig
	Outlet     Outlet
	Processors *processors.Processors
}

Forwarder contains shared options between all harvesters needed to forward events

func NewForwarder

func NewForwarder(cfg *common.Config, outlet Outlet) (*Forwarder, error)

NewForwarder creates a new forwarder instances and initialises processors if configured

func (*Forwarder) Send

func (f *Forwarder) Send(data *util.Data) error

Send updates the prospector state and sends the event to the spooler All state updates done by the prospector itself are synchronous to make sure not states are overwritten

type ForwarderConfig

type ForwarderConfig struct {
	common.EventMetadata `config:",inline"`      // Fields and tags to add to events.
	Type                 string                  `config:"type"`
	Pipeline             string                  `config:"pipeline"`
	Module               string                  `config:"_module_name"`  // hidden option to set the module name
	Fileset              string                  `config:"_fileset_name"` // hidden option to set the fileset name
	Processors           processors.PluginConfig `config:"processors"`
}

ForwarderConfig contains all config options shared by all harvesters

type Harvester

type Harvester interface {
	ID() uuid.UUID
	Run() error
	Stop()
}

Harvester contains all methods which must be supported by each harvester so the registry can be used by the prospector.

type Outlet

type Outlet interface {
	SetSignal(signal <-chan struct{})
	OnEventSignal(data *util.Data) bool
	OnEvent(data *util.Data) bool
}

Outlet interface is used for forwarding events

type Registry

type Registry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Registry struct manages (start / stop) a list of harvesters

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new registry object

func (*Registry) Len

func (r *Registry) Len() uint64

Len returns the current number of harvesters in the registry

func (*Registry) Start

func (r *Registry) Start(h Harvester)

Start starts the given harvester and add its to the registry

func (*Registry) Stop

func (r *Registry) Stop()

Stop stops all harvesters in the registry

func (*Registry) WaitForCompletion

func (r *Registry) WaitForCompletion()

WaitForCompletion can be used to wait until all harvesters are stopped

type Source

type Source interface {
	io.ReadCloser
	Name() string
	Stat() (os.FileInfo, error)
	Continuable() bool // can we continue processing after EOF?
	HasState() bool    // does this source have a state?
}

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