Documentation ¶
Overview ¶
Package kmsg provides access to kernel log.
nolint: dupl
Index ¶
Constants ¶
const MaxLineLength = 1024 - 48
MaxLineLength to be passed to kmsg, see https://github.com/torvalds/linux/blob/master/kernel/printk/printk.c#L450.
Variables ¶
This section is empty.
Functions ¶
func SetupLogger ¶ added in v0.5.0
SetupLogger configures the logger to write to the kernel ring buffer via /dev/kmsg.
If logger is nil, default `log` logger is redirectred.
If extraWriter is not nil, logs will be copied to it as well.
Types ¶
type Facility ¶ added in v0.3.0
type Facility int
Facility is an attribute of kernel log message.
type Message ¶ added in v0.3.0
type Message struct { Facility Facility Priority Priority SequenceNumber int64 Clock int64 Timestamp time.Time Message string }
Message is a parsed kernel log message.
func ParseMessage ¶ added in v0.3.0
ParseMessage parses internal kernel log format.
Reference: https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg
type Packet ¶ added in v0.3.0
Packet combines Message and error.
Only one of the fields is set in Reader.Scan.
type Reader ¶ added in v0.3.0
type Reader interface { // Scan and issue parsed messages. // // Scan stops when context is canceled or when EOF is reached // in NoFollow mode. Scan(ctx context.Context) <-chan Packet // Close releases resources associated with the Reader. Close() error }
Reader for /dev/kmsg messages.