logstore

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogEntry

type LogEntry struct {
	ID         string            `json:"id"`
	Timestamp  time.Time         `json:"timestamp"`
	Level      string            `json:"level"` // "debug", "info", "warn", "error", "fatal"
	Message    string            `json:"message"`
	Service    string            `json:"service"`
	TraceID    string            `json:"trace_id"` // correlation with traces
	SpanID     string            `json:"span_id"`
	Source     string            `json:"source"` // "sdk", "rum", "cloudwatch", "otlp"
	Attributes map[string]string `json:"attributes"`
}

LogEntry represents a single log record.

type LogStore

type LogStore interface {
	// Write persists a single log entry.
	Write(entry LogEntry) error

	// WriteBatch persists multiple log entries.
	WriteBatch(entries []LogEntry) error

	// Query returns log entries matching the given options.
	Query(opts QueryOpts) ([]LogEntry, error)

	// Tail returns a channel that streams matching log entries in real time.
	Tail(ctx context.Context, filter TailFilter) <-chan LogEntry

	// Services returns the list of distinct service names that have emitted logs.
	Services() ([]string, error)

	// LevelCounts returns the count of log entries by level.
	LevelCounts() (map[string]int, error)
}

LogStore defines the interface for persisting and querying logs.

type QueryOpts

type QueryOpts struct {
	Search    string // full-text search
	Level     string // filter by level
	Service   string // filter by service
	TraceID   string // filter by trace
	StartTime time.Time
	EndTime   time.Time
	Limit     int
}

QueryOpts specifies filters for querying logs.

type TailFilter

type TailFilter struct {
	Level   string
	Service string
	Search  string
}

TailFilter specifies filters for live-tailing logs.

Directories

Path Synopsis
Package filestore implements logstore.LogStore by wrapping the in-memory store with file-backed persistence.
Package filestore implements logstore.LogStore by wrapping the in-memory store with file-backed persistence.

Jump to

Keyboard shortcuts

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