kmsg

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package kmsg contains support for parsing Linux kernel log entries read from /dev/kmsg. These are the same log entries that can be read via the `dmesg` command. Each read from /dev/kmsg is guaranteed to return a single log entry, so no line-splitting is required.

More information can be found here: https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidFormat indicates the kmsg entry failed to parse.
	ErrInvalidFormat = errors.New("invalid kmsg format")
)

Functions

func ReadForever

func ReadForever(logLevel LogLevel)

ReadForever reads from /dev/kmsg forever unless /dev/kmsg cannot be opened. Every entry with priority <= 'logLevel' will be logged.

Types

type Entry

type Entry struct {
	Priority           LogLevel
	Facility           uint8
	Seq                uint64
	TimeSinceBootMicro uint64
	Flags              string
	Message            string
}

Entry is a single log entry in kmsg.

type LogLevel

type LogLevel uint8

LogLevel represents the severity/priority of a log entry in the kernels ring buffer. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/kern_levels.h?id=HEAD

const (
	Emerg LogLevel = iota
	Alert
	Crit
	Err
	Warning
	Notice
	Info
	Debug
)

func (LogLevel) String

func (logLevel LogLevel) String() string

Jump to

Keyboard shortcuts

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