ql

package
v0.2.7 Latest Latest
Warning

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

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

Documentation

Overview

Package ql implements support for parsing and running logsprays simple query expressions.

Query expressions set of label and value matches. The ql does not currently support matching of the message text itself, this will be corrected in future Either label or value can be given as a quoted string using ",', or ` quotes. Four match types are supported:

= : an exact match, or the single wild card "*" for any value
!= : any value not equal to the value
~ : A regular expression match, against the label value
!~ : A negated regular expression match against the label value

Matches for the same label are or'd together. Matches for different labels are and'd together.

For example:

job=somejob : a single match for a single job
"job"=somejob job="otherjob with long name" : match two specific jobsl
job=somejob instance=myserver : logs for job on a specific instance
job~things-.* : all jobs matching things
job=billing customer=* : all billing logs with any customer label set
job=billing customer~acme-.* : all billing logs with any acme- customer label set

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

Error provides details of a syntax error

func (Error) Error

func (err Error) Error() string

type MatchFunc added in v0.2.0

type MatchFunc func(hdr, m *logspray.Message, headerOnly bool) bool

MatchFunc describes a function that can be used to accept/reject messages. If headerOnly is passed, only the header message is matched against, and terms involving unmatched labels are ignored. headerOnly is used to filter files before filtering individual messages.

func Compile added in v0.2.0

func Compile(qstr string) (MatchFunc, error)

type Parser

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

Parser stores the state for the ivy parser.

type Scanner

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

Scanner holds the state of the scanner.

func (*Scanner) Next

func (l *Scanner) Next() Token

Next returns the next token.

type Token

type Token struct {
	Type Type   // The type of this item.
	Line int    // The line number on which this token appears
	Text string // The text of this item.
}

Token represents a token or text string returned from the scanner.

func (Token) Error added in v0.2.0

func (i Token) Error() string

func (Token) String

func (i Token) String() string

type Type

type Type int

Type identifies the type of lex items.

const (
	EOF      Type = iota // zero value so closed channel delivers EOF
	TokError             // error occurred; value is text of error
	Newline
	String   // A quoted string
	Atom     // a bare word
	Operator // Symbol made up of special chars
)

func (Type) String

func (i Type) String() string

Jump to

Keyboard shortcuts

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