Documentation
¶
Overview ¶
Package dmesg provides the functionality to poll the dmesg log.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultDmesgScanCommands = [][]string{
{"dmesg --decode --time-format=iso --nopager --buffer-size 163920"},
}
var DefaultWatchCommands = [][]string{
{"dmesg --decode --time-format=iso --nopager --buffer-size 163920 -w || true"},
{"dmesg --decode --time-format=iso --nopager --buffer-size 163920 || true"},
{"dmesg --decode --time-format=iso --nopager --buffer-size 163920 -W || true"},
}
Functions ¶
func ParseCtimeWithError ¶
ParseCtimeWithError Parses the timestamp from "dmesg --ctime" output lines. Returns a zero time if the timestamp is not found or the timestamp is invalid. Returns an error if the timestamp is not found or the timestamp is invalid.
func ParseISOtimeWithError ¶ added in v0.1.9
ParseISOtimeWithError parses the timestamp from "dmesg --time-format=iso" output lines. ref. "The definition of the iso timestamp is: YYYY-MM-DD<T>HH:MM:SS,<microseconds>←+><timezone offset from UTC>."
Types ¶
type LogLine ¶ added in v0.4.0
type LogLine struct {
Timestamp time.Time
Facility string
Level string
Content string
// Error is set when a dmesg command fails.
Error string
}
func ParseDmesgLine ¶ added in v0.4.0
parses the timestamp from "dmesg --time-format=iso" output lines. "The definition of the iso timestamp is: YYYY-MM-DD<T>HH:MM:SS,<microseconds>←+><timezone offset from UTC>."
type Watcher ¶ added in v0.4.0
type Watcher interface {
// Watch returns a channel that emits log lines.
// The channel is closed on (1) process exit, (2) on calling "Close" method
Watch() <-chan LogLine
// Closes the existing/ongoing watch/stream routines.
// Safe to call multiple times.
Close()
}