Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct { InputChan chan *Input OutputChan chan *Output // contains filtered or unexported fields }
Decoder splits raw data into lines and passes them to a lineHandler that emits outputs
func InitializeDecoder ¶
InitializeDecoder returns a properly initialized Decoder
func New ¶
func New(InputChan chan *Input, OutputChan chan *Output, lineHandler LineHandler, contentLenLimit int, matcher EndLineMatcher) *Decoder
New returns an initialized Decoder
func NewDecoderWithEndLineMatcher ¶
func NewDecoderWithEndLineMatcher(source *config.LogSource, parser parser.Parser, matcher EndLineMatcher) *Decoder
NewDecoderWithEndLineMatcher initialize a decoder with given endline strategy.
type EndLineMatcher ¶
type EndLineMatcher interface { // Match takes the existing bytes and the bytes to be appended, returns // true if the combination matches the end of line condition. Match(exists []byte, appender []byte, start int, end int) bool }
EndLineMatcher defines the criterion to whether to end a line or not.
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
Input represents a chunk of line.
type LineHandler ¶
type LineHandler interface { Handle(content []byte) Start() Stop() }
LineHandler handles raw lines to form structured lines
type MultiLineHandler ¶
type MultiLineHandler struct {
// contains filtered or unexported fields
}
MultiLineHandler makes sure that multiple lines from a same content are properly put together.
func NewMultiLineHandler ¶
func NewMultiLineHandler(outputChan chan *Output, newContentRe *regexp.Regexp, flushTimeout time.Duration, parser parser.Parser, lineLimit int) *MultiLineHandler
NewMultiLineHandler returns a new MultiLineHandler.
func (*MultiLineHandler) Handle ¶
func (h *MultiLineHandler) Handle(content []byte)
Handle forward lines to lineChan to process them.
type SingleLineHandler ¶
type SingleLineHandler struct {
// contains filtered or unexported fields
}
SingleLineHandler takes care of tracking the line length and truncating them when they are too long.
func NewSingleLineHandler ¶
func NewSingleLineHandler(outputChan chan *Output, parser parser.Parser, lineLimit int) *SingleLineHandler
NewSingleLineHandler returns a new SingleLineHandler.
func (*SingleLineHandler) Handle ¶
func (h *SingleLineHandler) Handle(content []byte)
Handle puts all new lines into a channel for later processing.