processor

package
v0.0.0-...-320d922 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitProcessor

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

LimitProcessor sets an upper limited on line length. Lines longer then the max configured line length will be snapped short.

func NewLimitProcessor

func NewLimitProcessor(in LineProcessor, maxBytes int) *LimitProcessor

NewLimitProcessor creates a new processor limiting the line length.

func (*LimitProcessor) Next

func (p *LimitProcessor) Next() (Line, error)

Next returns the next line.

type Line

type Line struct {
	Ts      time.Time // timestamp the line was read
	Content []byte    // actual line read
	Bytes   int       // total number of bytes read to generate the line
}

Line represents a line event with timestamp, content and actual number of bytes read from input before decoding.

type LineProcessor

type LineProcessor interface {
	Next() (Line, error)
}

LineProcessor is the interface that wraps the basic Next method for getting a new line. Next returns the line being read or and error. EOF is returned if processor will not return any new lines on subsequent calls.

type LineSource

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

LineSource produces lines by reading lines from an io.Reader through a decoder converting the reader it's encoding to utf-8.

func NewLineSource

func NewLineSource(
	in io.Reader,
	codec encoding.Encoding,
	bufferSize int,
) (LineSource, error)

NewLineSource creates a new LineSource from input reader by applying the given codec.

func (LineSource) Next

func (p LineSource) Next() (Line, error)

Next reads the next line from it's initial io.Reader

type MultiLine

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

MultiLine processor combining multiple line events into one multi-line event.

Lines to be combined are matched by some configurable predicate using regular expression.

The maximum number of bytes and lines to be returned is fully configurable. Even if limits are reached subsequent lines are matched, until event is fully finished.

Errors will force the multiline processor to return the currently active multiline event first and finally return the actual error on next call to Next.

func NewMultiline

func NewMultiline(
	r LineProcessor,
	maxBytes int,
	config *config.MultilineConfig,
) (*MultiLine, error)

NewMultiline creates a new multi-line processor combining stream of line events into stream of multi-line events.

func (*MultiLine) Next

func (mlr *MultiLine) Next() (Line, error)

Next returns next multi-line event.

type StripNewline

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

StripNewline processor removes the last trailing newline characters from read lines.

func NewStripNewline

func NewStripNewline(r LineProcessor) *StripNewline

NewStripNewline creates a new line reader stripping the last tailing newline.

func (*StripNewline) Next

func (p *StripNewline) Next() (Line, error)

Next returns the next line.

Jump to

Keyboard shortcuts

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