Struct systemd::journal::Journal
[−]
[src]
pub struct Journal { /* fields omitted */ }
A reader for systemd journal.
Supports read, next, previous, and seek operations.
Methods
impl Journal
[src]
fn open(
files: JournalFiles,
runtime_only: bool,
local_only: bool
) -> Result<Journal>
files: JournalFiles,
runtime_only: bool,
local_only: bool
) -> Result<Journal>
Open the systemd journal for reading.
Params:
- files: the set of journal files to read. If the calling process
doesn't have permission to read the system journal, a call to
Journal::open
withSystem
orAll
will succeed, but system journal entries won't be included. This behavior is due to systemd. - runtime_only: if true, include only journal entries from the current boot. If false, include all entries.
- local_only: if true, include only journal entries originating from localhost. If false, include all entries.
fn next_record(&mut self) -> Result<Option<JournalRecord>>
Read the next record from the journal. Returns Ok(None)
if there
are no more records to read.
fn previous_record(&mut self) -> Result<Option<JournalRecord>>
fn seek(&mut self, seek: JournalSeek) -> Result<String>
Seek to a specific position in journal. On success, returns a cursor to the current entry.
fn cursor(&self) -> Result<String>
Returns the cursor of current journal entry
fn timestamp(&self) -> Result<SystemTime>
Returns timestamp at which current journal is recorded
fn match_add<T: Into<Vec<u8>>>(
&mut self,
key: &str,
val: T
) -> Result<&mut Journal>
&mut self,
key: &str,
val: T
) -> Result<&mut Journal>
Adds a match by which to filter the entries of the journal. If a match is applied, only entries with this field set will be iterated.
fn match_or(&mut self) -> Result<&mut Journal>
Inserts a disjunction (i.e. logical OR) in the match list.
fn match_and(&mut self) -> Result<&mut Journal>
Inserts a conjunction (i.e. logical AND) in the match list.
fn match_flush(&mut self) -> Result<&mut Journal>
Flushes all matches, disjunction and conjunction terms. After this call all filtering is removed and all entries in the journal will be iterated again.