journal

package
v0.0.0-...-84b758b Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package journal provides a simplified journal API. The sdjournal library is quite lowlevel, the API provided here is a bit more high-level and more intuitive to use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry sdjournal.JournalEntry

Entry is a single entry from the journal.

func (*Entry) MatchString

func (e *Entry) MatchString() string

MatchString returns the entry formatted for matching. This includes the systemd unit name and the message only. If the systemd unit name is not available, this falls back to the command, and if that is also not available, the syslog identifier.

func (*Entry) ShortString

func (e *Entry) ShortString() string

ShortString returns the entry as a single line, very similar to a typical line from syslog.

func (*Entry) VerboseString

func (e *Entry) VerboseString() string

VerboseString returns the entry formatted like journalctl's verbose output format, with one key-value-pair per line.

type Journal

type Journal sdjournal.Journal

Journal is a handle for a journal to talk to.

func New

func New() (*Journal, error)

New returns a handle to the journal the current user can read. For root, this is the system journal. For other users, this is usually just their own journal.

func (*Journal) Next

func (j *Journal) Next() (entry *Entry, err error)

Next returns the next entry. This entry is nil if the cursor is at the end of the journal.

func (*Journal) SeekCursor

func (j *Journal) SeekCursor(cursor string) error

SeekCursor moves the current cursor past the element pointed to by the cursor name, so further reading proceeds after this last element.

func (*Journal) SeekLast

func (j *Journal) SeekLast(last int) error

SeekLast moves the cursor so that further processing will result in `last` entries until the end of the journal (provided no new entries are added in the meantime).

Jump to

Keyboard shortcuts

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