Documentation
¶
Overview ¶
Package journal is a pure-Go, read-only reader of the systemd journal file format.
Index ¶
Constants ¶
const DefaultCursorKey = "journal/cursor"
DefaultCursorKey is the kv key of the persisted cursor.
Variables ¶
var ErrCorrupt = errors.New("journal: corrupt file")
ErrCorrupt reports a structurally invalid journal file.
var ErrUnsupported = errors.New("journal: unsupported file")
ErrUnsupported reports a file using incompatible features this reader does not implement.
Functions ¶
This section is empty.
Types ¶
type Cursor ¶
Cursor identifies a position: the sequence number domain, the sequence number, and realtime in microseconds.
func ParseCursor ¶
ParseCursor parses the form written by Cursor.String; unknown keys are ignored.
type Entry ¶
Entry is one journal entry.
type Options ¶
type Options struct {
// Dirs are scanned with their immediate subdirectories (the machine ID directories).
Dirs []string
// Store persists the cursor under CursorKey; nil keeps it in memory only.
Store kv.Store
CursorKey string
// Since skips older entries when no cursor is stored; zero reads from the head.
Since time.Time
PollInterval time.Duration
MaxObjectBytes int64
}
Options configures a Reader.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader merges the entries of every journal file in realtime order. It is not safe for concurrent use.
func (*Reader) Cursor ¶
Cursor returns the position of the last delivered entry, or the loaded cursor.
func (*Reader) FileErrors ¶
FileErrors returns files skipped because they are corrupt or unsupported, by path.
func (*Reader) Follow ¶
Follow delivers entries until ctx ends or fn fails, saving the cursor per batch and, on failure, before the failed entry.