Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTimeSpec is the error of a since or until that is not a time, // or of a since after the until: the window can not be read. ErrTimeSpec = errors.New("invalid time") // ErrFollowUntil is the error of a follow bounded by an until: // journalctl -f ignores --until, and would follow past it. ErrFollowUntil = errors.New("until can not be used with follow") )
var ErrGrepUnsupported = errors.New("--grep: unsupported by this journalctl (systemd < 237 or built without PCRE2)")
ErrGrepUnsupported is the error of a read filtering on a pattern where journalctl has no --grep: a journalctl older than systemd 237, or built without PCRE2, as rhel7's. The read used to answer no line, as if none matched.
Functions ¶
func ParseTime ¶
ParseTime returns the time of a since or an until: a negative duration before now, "-1h" an hour ago, or a RFC3339 time, "2026-12-02T10:00:00Z" or "2026-12-02T10:00:00+01:00". Empty is the zero time, no bound. A positive duration is refused: "1h" would read as an hour ago or in an hour.
Types ¶
type Event ¶
func (*Event) RenderConsole ¶
func (event *Event) RenderConsole()
func (*Event) RenderData ¶
func (event *Event) RenderData()
type Events ¶
type Events []Event
func (Events) MatchString ¶
func (Events) RenderConsole ¶
func (events Events) RenderConsole()
func (Events) RenderData ¶
func (events Events) RenderData()
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) Start ¶
func (stream *Stream) Start(streamConfig StreamConfig) error
Start starts the read of the config. A config journalctl would not read as asked is refused before anything is sent: ErrFollowUntil, ErrTimeSpec for a since after the until, ErrGrepUnsupported.
type StreamConfig ¶
type StreamConfig struct {
Follow bool
// Lines is the number of the last entries read. With Since or
// Until set, it is the last entries of their window, every entry
// of it when 0 or less.
Lines int
Matches []string
Grep *string
// Since and Until bound the entries read to a window, as
// ParseTime returns them. The zero time is no bound. Until is
// refused with Follow, which journalctl would ignore.
Since time.Time
Until time.Time
}