kmsg

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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