Documentation
¶
Overview ¶
Package systemd uses the native systemctl/journalctl commands to interact with the systemd and journald services.
Index ¶
Constants ¶
View Source
const ( Emergency = Priority("0") Alert = Priority("1") Critical = Priority("2") Error = Priority("3") Warning = Priority("4") Notice = Priority("5") Informational = Priority("6") Debug = Priority("7") )
Priority levels
View Source
const ( // Enabled is a state reported by systemctl Enabled = UnitFileState("enabled") // Disabled is a state reported by systemctl Disabled = UnitFileState("disabled") // Active is a state reported by systemctl Active = ActiveState("active") // Inactive is a state reported by systemctl Inactive = ActiveState("inactive") // Running is a substate reported by systemctl Running = SubState("running") // Dead is a substate reported by systemctl Dead = SubState("dead") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
Cursor string `json:"__CURSOR"` // The __CURSOR field
Timestamp int64 `json:"__REALTIME_TIMESTAMP,string"` // The __REALTIME__TIMESTAMP field (microseconds since epoch)
Message string `json:"MESSAGE"` // The MESSAGE field
Unit string `json:"_SYSTEMD_UNIT"` // The _SYSTEMD_UNIT field
Priority Priority `json:"PRIORITY"` // The PRIORITY field
UnitResult string `json:"UNIT_RESULT"` // The UNIT_RESULT field. This is set if the service has terminated for some reason. It is empty otherwise
}
Entry is a single entry from journald
type Journalctl ¶
type Journalctl interface {
// Entries returns the last entry in the journal. If there is no entries
// an empty entry will be returned
LastEntry(unit string) (*Entry, error)
// EntriesAfter returns entries after the specified cursor position. The
// newest entry is returned first. If the cursor parameter is empty the
// last 100 entries are returned.
EntriesAfter(unit string, cursor string) ([]Entry, error)
}
Journalctl interacts with the native journalctl installation to pull logs from the systemd-journald
type Systemctl ¶
type Systemctl interface {
// State returns unit file, active and substate for the unit.
State(unitName string) (UnitFileState, ActiveState, SubState, error)
// Restart restarts the unit
Restart(unitName string) error
}
Systemctl interacts with the native systemcl command
Click to show internal directories.
Click to hide internal directories.