log

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Filtered = errors.New("filtered")

Functions

func ParseReq added in v1.13.0

func ParseReq(req string) (string, string, string)

func StringTimeEqual added in v1.9.0

func StringTimeEqual(l string, r time.Time) bool

func StringTimeGreaterThan added in v1.9.0

func StringTimeGreaterThan(l string, r time.Time) bool

func StringTimeGreaterThanEqual added in v1.9.0

func StringTimeGreaterThanEqual(l string, r time.Time) bool

func StringTimeLessThan added in v1.9.0

func StringTimeLessThan(l string, r time.Time) bool

func StringTimeLessThanEqual added in v1.9.0

func StringTimeLessThanEqual(l string, r time.Time) bool

func StringTimeNotEqual added in v1.9.0

func StringTimeNotEqual(l string, r time.Time) bool

func TimeStringEqual added in v1.9.0

func TimeStringEqual(l time.Time, r string) bool

func TimeStringGreaterThan added in v1.9.0

func TimeStringGreaterThan(l time.Time, r string) bool

func TimeStringGreaterThanEqual added in v1.9.0

func TimeStringGreaterThanEqual(l time.Time, r string) bool

func TimeStringLessThan added in v1.9.0

func TimeStringLessThan(l time.Time, r string) bool

func TimeStringLessThanEqual added in v1.9.0

func TimeStringLessThanEqual(l time.Time, r string) bool

func TimeStringNotEqual added in v1.9.0

func TimeStringNotEqual(l time.Time, r string) bool

Types

type ExprEnv added in v1.9.0

type ExprEnv struct {
	Req                        string    `expr:"req"`
	Method                     string    `expr:"method"`
	Uri                        string    `expr:"uri"`
	Status                     int       `expr:"status"`
	Time                       time.Time `expr:"time"`
	Uid                        string    `expr:"uid"`
	SetNewUid                  bool      `expr:"setNewUid"`
	TimeStringEqual            func(l time.Time, r string) bool
	TimeStringNotEqual         func(l time.Time, r string) bool
	TimeStringGreaterThan      func(l time.Time, r string) bool
	TimeStringGreaterThanEqual func(l time.Time, r string) bool
	TimeStringLessThan         func(l time.Time, r string) bool
	TimeStringLessThanEqual    func(l time.Time, r string) bool
	StringTimeEqual            func(l string, r time.Time) bool
	StringTimeNotEqual         func(l string, r time.Time) bool
	StringTimeGreaterThan      func(l string, r time.Time) bool
	StringTimeGreaterThanEqual func(l string, r time.Time) bool
	StringTimeLessThan         func(l string, r time.Time) bool
	StringTimeLessThanEqual    func(l string, r time.Time) bool
}

type FilterExpr added in v1.9.0

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

func NewFilterExpr added in v1.9.0

func NewFilterExpr(code string) (*FilterExpr, error)

func (*FilterExpr) Run added in v1.9.0

func (f *FilterExpr) Run(entry LogEntry) (bool, error)

type LTSVReadOpt

type LTSVReadOpt struct {
	MatchingGroups []string
	TimeFormat     string
	Labels         map[string]string
	Filter         string
}

type LTSVReader

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

func NewLTSVReader

func NewLTSVReader(r io.Reader, opt LTSVReadOpt) (*LTSVReader, error)

func (*LTSVReader) Parse

func (r *LTSVReader) Parse(entry *LogEntry) (*LogEntry, error)

Parse parses one line of log file into LogEntry struct For reducing memory allocation, you can pass a LogEntry to record to reuse the given one.

func (*LTSVReader) Read

func (r *LTSVReader) Read() bool

type LogEntry

type LogEntry struct {
	Req          string
	Method       string
	Uri          string
	Status       int
	Uid          string
	SetNewUid    bool
	Time         time.Time
	MatchedGroup *regexp.Regexp
}

func (LogEntry) Key

func (e LogEntry) Key() string

Jump to

Keyboard shortcuts

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