codecs

package
v2.0.5+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFilterCodecFactory

func NewFilterCodecFactory(config *config.Config, configPath string, unused map[string]interface{}, name string) (interface{}, error)

NewFilterCodecFactory creates a new FilterCodecFactory for a codec definition in the configuration file. This factory can be used to create instances of a filter codec for use by harvesters

func NewMultilineCodecFactory

func NewMultilineCodecFactory(config *config.Config, configPath string, unused map[string]interface{}, name string) (interface{}, error)

NewMultilineCodecFactory creates a new MultilineCodecFactory for a codec definition in the configuration file. This factory can be used to create instances of a multiline codec for use by harvesters

func NewPlainCodecFactory

func NewPlainCodecFactory(config *config.Config, configPath string, unUsed map[string]interface{}, name string) (interface{}, error)

NewPlainCodecFactory creates a new factory structure from the configuration data in the configuration file.

Types

type CallbackFunc

type CallbackFunc func(int64, int64, string)

CallbackFunc is a callback function that a codec will call for each of its "output" events. It could be called at any time by any routine (not necessarily the routine providing the "input" events.)

type Codec

type Codec interface {
	Teardown() int64
	Reset()
	Event(int64, int64, string)
	Meter()
	APIEncodable() admin.APIEncodable
}

Codec is the generic interface that all codecs implement

func NewCodec

func NewCodec(factory interface{}, callbackFunc CallbackFunc, offset int64) Codec

NewCodec returns a Codec interface initialised from the given Factory

type CodecFilter

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

CodecFilter is an instance of a filter codec that is used by the Harvester for filtering

func (*CodecFilter) APIEncodable

func (c *CodecFilter) APIEncodable() admin.APIEncodable

APIEncodable is called to get the codec status for the API

func (*CodecFilter) Event

func (c *CodecFilter) Event(startOffset int64, endOffset int64, text string)

Event is called by a Harvester when a new line event occurs on a file. Filtering takes place and only accepted lines are shipped to the callback

func (*CodecFilter) Meter

func (c *CodecFilter) Meter()

Meter is called by the Harvester to request accounting

func (*CodecFilter) Reset

func (c *CodecFilter) Reset()

Reset restores the codec to a blank state so it can be reused on a new file stream

func (*CodecFilter) Teardown

func (c *CodecFilter) Teardown() int64

Teardown ends the codec and returns the last offset shipped to the callback

type CodecFilterFactory

type CodecFilterFactory struct {
	Patterns []string `config:"patterns"`
	Match    string   `config:"match"`
	// contains filtered or unexported fields
}

CodecFilterFactory holds the configuration for a filter codec

func (*CodecFilterFactory) NewCodec

func (f *CodecFilterFactory) NewCodec(callbackFunc CallbackFunc, offset int64) Codec

NewCodec returns a new codec instance that will send events to the callback function provided upon completion of processing

type CodecMultiline

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

CodecMultiline is an instance of a multiline codec that is used by the Harvester for multiline processing

func (*CodecMultiline) APIEncodable

func (c *CodecMultiline) APIEncodable() admin.APIEncodable

APIEncodable is called to get the codec status for the API

func (*CodecMultiline) Event

func (c *CodecMultiline) Event(startOffset int64, endOffset int64, text string)

Event is called by a Harvester when a new line event occurs on a file. Multiline processing takes place and when a complete multiline event is found as described by the configuration it is shipped to the callback

func (*CodecMultiline) Meter

func (c *CodecMultiline) Meter()

Meter is called by the Harvester to request accounting

func (*CodecMultiline) Reset

func (c *CodecMultiline) Reset()

Reset restores the codec to a blank state so it can be reused on a new file stream

func (*CodecMultiline) Teardown

func (c *CodecMultiline) Teardown() int64

Teardown ends the codec and returns the last offset shipped to the callback

type CodecMultilineFactory

type CodecMultilineFactory struct {
	Patterns          []string      `config:"patterns"`
	Match             string        `config:"match"`
	What              string        `config:"what"`
	PreviousTimeout   time.Duration `config:"previous timeout"`
	MaxMultilineBytes int64         `config:"max multiline bytes"`
	// contains filtered or unexported fields
}

CodecMultilineFactory holds the configuration for a multiline codec

func (*CodecMultilineFactory) NewCodec

func (f *CodecMultilineFactory) NewCodec(callbackFunc CallbackFunc, offset int64) Codec

NewCodec returns a new codec instance that will send events to the callback function provided upon completion of processing

type CodecPlain

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

CodecPlain is an instance of this codec, in use by a single harvester

func (*CodecPlain) APIEncodable

func (c *CodecPlain) APIEncodable() admin.APIEncodable

APIEncodable is called to get the status for the API Meter and APIEncodable are already synchronised by the Harvester, so you do not need to worry about race conditions between them

func (*CodecPlain) Event

func (c *CodecPlain) Event(startOffset int64, endOffset int64, text string)

Event is called for every log event, the resulting log event(s) to be transmitted should be passed through the codec callback when ready

func (*CodecPlain) Meter

func (c *CodecPlain) Meter()

Meter is called by the harvester periodically to allow the codec to calculate statistics if necessary It is called from the harvester routine so synchronisation is unnecessary

func (*CodecPlain) Reset

func (c *CodecPlain) Reset()

Reset is called when a log file is truncated, and it should cause the codec to reset itself as if it was only just created

func (*CodecPlain) Teardown

func (c *CodecPlain) Teardown() int64

Teardown shuts down the codec and it should return the last offset sent by the codec. This is used by the harvester as the resume point.

type CodecPlainFactory

type CodecPlainFactory struct {
}

CodecPlainFactory holds the configuration, it is responsible for generating instances as required when new log files are opened

func (*CodecPlainFactory) NewCodec

func (f *CodecPlainFactory) NewCodec(callbackFunc CallbackFunc, offset int64) Codec

NewCodec creates a new codec instance starting at the given offset

type PatternCollection

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

PatternCollection holds a list of patterns that can be matched against text

func (*PatternCollection) Match

func (c *PatternCollection) Match(text string) bool

Match attempts to match the given text against the set patterns

func (*PatternCollection) Set

func (c *PatternCollection) Set(patterns []string, match string) error

Set the pattern list to use and whether to match "any" or "all"

Jump to

Keyboard shortcuts

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