scraper

package
v0.11.29 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pipe

func Pipe(scraper Scraper) (<-chan servicelog.Entry, io.Writer)

Pipe returns a channel with log entries and writer that can be used as a data provider for given scraper.

Types

type Filter

type Filter interface {
	Match([]byte) bool
}

Filter is an interface that performs filtering tasks during log scraping. It allows to ignore log values based on implementation logic.

type FilterFunc

type FilterFunc func([]byte) bool

The FilterFunc type is an adapter to allow the use of ordinary functions as scraping filters. If f is a function with the appropriate signature, FilterFunc(f) is a Filter that calls f.

func (FilterFunc) Match

func (f FilterFunc) Match(value []byte) bool

Match calls f(value).

type JSON added in v0.11.7

type JSON struct {
	InvalidLogsWriter       io.Writer
	KeyFilter               Filter
	BufferSize              uint
	ScrapUnmarshallableLogs bool
	// contains filtered or unexported fields
}

JSON is a scraper for logs represented as JSON objects.

func (*JSON) StartScraping added in v0.11.7

func (j *JSON) StartScraping(reader io.Reader) <-chan servicelog.Entry

StartScraping starts scraping logs in JSON format from given reader and sends parsed entries to the returned unbuffered channel. Logs are scraped as long as the passed reader does not return an io.EOF error.

type LogFmt

type LogFmt struct {
	KeyFilter Filter
}

LogFmt is a scraper for logs in logfmt format.

See: https://brandur.org/logfmt

func (*LogFmt) StartScraping

func (logFmt *LogFmt) StartScraping(reader io.Reader) <-chan servicelog.Entry

StartScraping starts scraping logs in logfmt format from given reader and sends parsed entries to the returned unbuffered channel. Logs are scraped as long as the passed reader does not return an io.EOF error.

type Scraper

type Scraper interface {
	StartScraping(io.Reader) <-chan servicelog.Entry
}

Scraper in an interface for various scrapers that support different log formats.

type ValueFilter

type ValueFilter struct {
	Values [][]byte
}

ValueFilter allows to ignore specific values during log scraping.

func (ValueFilter) Match

func (f ValueFilter) Match(v []byte) bool

Match returns true if passed value is on the filtered list - false otherwise.

Jump to

Keyboard shortcuts

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