entryreader

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultValuesLimit = 20
	MaxValuesLimit     = 100
)
View Source
const (
	DefaultHistogramBuckets = 60
	MaxHistogramBuckets     = 200
	MaxHistogramGroups      = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldValue

type FieldValue struct {
	Value string
	Count uint64
}

type HistogramBucket

type HistogramBucket struct {
	Start  time.Time
	Counts map[string]int
}

type HistogramRequest

type HistogramRequest struct {
	Query   string
	Since   time.Time
	Until   time.Time
	Buckets int
	// GroupBy splits the counts by the values of this field; empty counts
	// everything into a single "all" group.
	GroupBy string
}

type HistogramResponse

type HistogramResponse struct {
	Start    time.Time
	End      time.Time
	BucketMs int64
	// Groups in display order (severity for levels, count otherwise).
	Groups  []string
	Buckets []HistogramBucket
}

type Matcher

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

Matcher evaluates the web UI search syntax against individual entries by running each one through a private in-memory bleve index: index the entry, run the query, drop the entry. Slower than a hand-written evaluator, but the filter and the web search cannot drift apart.

func NewMatcher

func NewMatcher(expr string) (*Matcher, error)

func (*Matcher) Close

func (m *Matcher) Close() error

func (*Matcher) Match

func (m *Matcher) Match(ctx context.Context, entry *domain.Entry) (bool, error)

type Reader

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

Reader searches log entries indexed by processors.Indexer.

func NewReader

func NewReader(index bleve.Index) *Reader

func (*Reader) FieldValues

func (r *Reader) FieldValues(_ context.Context, field, prefix string, limit int) ([]FieldValue, error)

FieldValues returns the indexed terms of a field, optionally filtered by prefix, with the number of entries containing each term. Terms come from the search index, so they are the analyzed (lowercased/tokenized) forms that fielded queries actually match. Fields indexed in binary form (timestamps, numerics) yield no printable terms and return an empty list.

func (*Reader) Fields

func (r *Reader) Fields(_ context.Context) ([]string, error)

Fields returns the names of the fields available for searching, sorted alphabetically.

func (*Reader) Histogram

func (r *Reader) Histogram(ctx context.Context, req HistogramRequest) (HistogramResponse, error)

Histogram counts matching entries into time buckets, optionally split by the values of a field. bleve has no sub-aggregations, so the counts come from one date-range facet search per group.

func (*Reader) Search

func (r *Reader) Search(ctx context.Context, req SearchRequest) (SearchResponse, error)

type SearchRequest

type SearchRequest struct {
	Since    time.Time
	Until    time.Time
	Query    string
	PageSize int
	// Ascending returns the oldest matching entries first (used by the live
	// tail to page through a window without losing entries). Default is
	// newest first.
	Ascending bool
}

type SearchResponse

type SearchResponse struct {
	Count    int64
	Entries  []*domain.LogEntry
	Duration time.Duration
}

Jump to

Keyboard shortcuts

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