pstore

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package pstore provides operations for Linux pstore, mainly to read the pstore log on reboot. ref. https://www.freedesktop.org/software/systemd/man/latest/systemd-pstore.service.html

Index

Constants

View Source
const DefaultPstoreDir = "/var/lib/systemd/pstore"

DefaultPstoreDir is the default directory for pstore logs. e.g., "/var/lib/systemd/pstore/7530486857247/dmesg.txt" The numeric subdirectory (e.g., "7530486857247") is a unique identifier generated by systemd-pstore, often based on the machine's DMI product UUID, to distinguish logs from different machines or boot instances.

Variables

This section is empty.

Functions

This section is empty.

Types

type History

type History struct {
	// Timestamp represents the event timestamp in unix seconds.
	Timestamp  int64
	EventName  string
	Message    string
	RawMessage string
}

type Store

type Store interface {
	// Scan scans the pstore logs with the match function, and inserts
	// the matching events into the database.
	Scan(ctx context.Context, matchFunc func(line string) (eventName string, message string)) error

	// Get returns the history events since the given timestamp.
	Get(ctx context.Context, since time.Time) ([]History, error)
}

func New

func New(dir string, dbRW *sql.DB, dbRO *sql.DB, tableName string, lookBackPeriod time.Duration) (Store, error)

Jump to

Keyboard shortcuts

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