kmsg

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2025 License: Apache-2.0 Imports: 16 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 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 Watcher

type Watcher interface {
	// Watch reads from kmsg and provides a channel of messages.
	// Watch will always close the provided channel before returning.
	// Watch 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() (Watcher, error)

Creates a new watcher that will read from /dev/kmsg.

func StartWatch

func StartWatch(matchFunc func(line string) (eventName string, message string)) (Watcher, error)

StartWatch creates a new events watcher that will watch the kmsg. Experimental. TODO: integrate with the events store.

Jump to

Keyboard shortcuts

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