kmsg

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWatcherAlreadyStarted = errors.New("watcher already started")
)

Functions

This section is empty.

Types

type EventDedupWindowFunc added in v0.11.2

type EventDedupWindowFunc func(eventstore.Event) (time.Duration, bool)

type MatchFunc added in v0.5.0

type MatchFunc func(line string) (eventName string, message string)

type Message

type Message struct {
	Timestamp      metav1.Time `json:"timestamp"`
	Priority       int         `json:"priority"`
	SequenceNumber int         `json:"sequence_number"`
	Message        string      `json:"message"`
}

Message represents a given kmsg logline, including its timestamp (as calculated based on offset from boot time), its possibly multi-line body, and so on. More information about these mssages may be found here: https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg

func ReadAll

func ReadAll(ctx context.Context) ([]Message, error)

ReadAll reads all messages from the kmsg file, with no follow mode.

func (Message) DescribeTimestamp

func (m Message) DescribeTimestamp(since time.Time) string

type Op added in v0.10.0

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

type OpOption added in v0.10.0

type OpOption func(*Op)

func WithCacheKeyTruncateSeconds added in v0.10.0

func WithCacheKeyTruncateSeconds(seconds int) OpOption

func WithEventDedupWindowFunc added in v0.11.2

func WithEventDedupWindowFunc(fn EventDedupWindowFunc) OpOption

WithEventDedupWindowFunc applies an event-specific dedup window in the syncer. When the callback returns a positive window, pkg/kmsg deduplicates matching events against recent persisted events inside that time window instead of using the generic parsed-message cache and infinite exact-match lookup.

type Syncer added in v0.5.0

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

Syncer syncs kernel message matched by MatchFunc to eventstore bucket

func NewSyncer added in v0.5.0

func NewSyncer(ctx context.Context, matchFunc MatchFunc, eventBucket eventstore.Bucket, opts ...OpOption) (*Syncer, error)

func (*Syncer) Close added in v0.5.0

func (w *Syncer) Close()

type Watcher

type Watcher interface {
	// Watch starts a goroutine to read from kmsg and provide a channel of messages.
	// Watcher is responsible for closing the channel when the watch is done.
	// Watcher may be canceled by calling 'Close' on the parser.
	//
	// The caller should drain the channel after calling 'Close'.
	Watch() (<-chan Message, error)
	Close() error
}

func NewWatcher

func NewWatcher(opts ...OpOption) (Watcher, error)

NewWatcher creates a new watcher that will read from /dev/kmsg.

Directories

Path Synopsis
Package writer implements the kmsg writer.
Package writer implements the kmsg writer.

Jump to

Keyboard shortcuts

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