scraper

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

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 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