Fields longer than this will be truncated to the threshold size. Defaults to 64Kb.get_catalog(id128) -> str
Retrieve a message catalog entry for the given id. Wraps man:sd_journal_get_catalog_for_message_id(3).get_catalog() -> str
Retrieve a message catalog entry for the current journal entry. Will throw IndexError if the entry has no MESSAGE_ID and KeyError is the id is specified, but hasn't been found in the catalog.
Returns true if persistent journal files have been found.
See man:sd_journal_test_cursor(3).has_runtime_files(str) -> bool
Returns true if runtime journal files have been found.
See man:sd_journal_test_cursor(3).enumerate_fields(field) -> a set of values
Return a set of field names appearing in the journal. See sd_journal_enumerate_fields(3).query_unique(field) -> a set of values
Return a set of unique values appearing in journal for the given `field`. Note this does not respect any journal matches. See sd_journal_query_unique(3).test_cursor(str) -> bool
Test whether the cursor string matches current journal entry.
Wraps sd_journal_test_cursor(). See man:sd_journal_test_cursor(3).get_cursor() -> str
Return a cursor string for the current journal entry.
Wraps sd_journal_get_cursor(). See man:sd_journal_get_cursor(3).seek_cursor(cursor) -> None
Seek to journal entry by given unique reference `cursor`.wait([timeout]) -> state change (integer)
Wait for a change in the journal. Argument `timeout` specifies the maximum number of microseconds to wait before returning regardless of whether the journal has changed. If `timeout` is -1, then block forever.
Will return constants: NOP if no change; APPEND if new entries have been added to the end of the journal; and INVALIDATE if journal files have been added or removed.
See man:sd_journal_wait(3) for further discussion.process() -> state change (integer)
Process events and reset the readable state of the file descriptor returned by .fileno().
Will return constants: NOP if no change; APPEND if new entries have been added to the end of the journal; and INVALIDATE if journal files have been added or removed.
See man:sd_journal_process(3) for further discussion.seek_monotonic(monotonic[, bootid]) -> None
Seek to nearest matching journal entry to `monotonic`. Argument `monotonic` is an timestamp from boot in microseconds. Argument `bootid` is a string representing which boot the monotonic time is reference to. Defaults to current bootid.seek_realtime(realtime) -> None
Seek to nearest matching journal entry to `realtime`. Argument `realtime` in specified in seconds.seek_tail() -> None
Jump to the end of the journal. This method invokes sd_journal_seek_tail(). See man:sd_journal_seek_tail(3).seek_head() -> None
Jump to the beginning of the journal. This method invokes sd_journal_seek_head(). See man:sd_journal_seek_head(3).flush_matches() -> None
Clear all current match filters.add_conjunction() -> None
Inserts a logical AND between matches added since previous add_disjunction() or add_conjunction() and the next add_disjunction() or add_conjunction().
See man:sd_journal_add_disjunction(3) for explanation.add_disjunction() -> None
Inserts a logical OR between matches added since previous add_disjunction() or add_conjunction() and the next add_disjunction() or add_conjunction().
See man:sd_journal_add_disjunction(3) for explanation.add_match(match) -> None
Add a match to filter journal log entries. All matches of different fields are combined with logical AND, and matches of the same field are automatically combined with logical OR. Match is a string of the form "FIELD=value".get_monotonic() -> (timestamp, bootid)
Return the monotonic timestamp for the current journal entry as a tuple of time in microseconds and bootid.
Wraps sd_journal_get_monotonic_usec(). See man:sd_journal_get_monotonic_usec(3).get_realtime() -> int
Return the realtime timestamp for the current journal entry in microseconds.
Wraps sd_journal_get_realtime_usec(). See man:sd_journal_get_realtime_usec(3)._get_all() -> dict
Return dictionary of the current log entry.get(str) -> str
Return data associated with this key in current log entry. Throws KeyError is the data is not available.previous([skip]) -> bool
Go to the previous log entry. Optional skip value means to go to the `skip`\-th previous log entry. Returns False if at start of file, True otherwise.next([skip]) -> bool
Go to the next log entry. Optional skip value means to go to the `skip`\-th log entry. Returns False if at end of file, True otherwise.__exit__(type, value, traceback) -> None
Part of the context manager protocol. Closes the journal. __enter__() -> self
Part of the context manager protocol. Returns self. get_usage() -> int
Returns the total disk space currently used by journal files (in bytes). If `SD_JOURNAL_LOCAL_ONLY` was passed when opening the journal this value will only reflect the size of journal files of the local host, otherwise of all hosts.
This method invokes sd_journal_get_usage(). See man:sd_journal_get_usage(3).close() -> None
Free resources allocated by this Reader object. This method invokes sd_journal_close(). See man:sd_journal_close(3).get_timeout_ms() -> int
Returns a timeout value suitable for usage in poll(), the value returned by .get_timeout() converted to relative ms, or -1 if no timeout is necessary.get_timeout() -> int or None
Returns a timeout value for usage in poll(), the time since the epoch of clock_gettime(2) in microseconds, or None if no timeout is necessary.
The return value must be converted to a relative timeout in milliseconds if it is to be used as an argument for poll(). See man:sd_journal_get_timeout(3) for further discussion.get_events() -> int
Returns a mask of poll() events to wait for on the file descriptor returned by .fileno().
See man:sd_journal_get_events(3) for further discussion.reliable_fd() -> bool
Returns True iff the journal can be polled reliably. This method invokes sd_journal_reliable_fd(). See man:sd_journal_reliable_fd(3).fileno() -> int
Get a file descriptor to poll for changes in the journal. This method invokes sd_journal_get_fd(). See man:sd_journal_get_fd(3)._Reader([flags | path | files]) -> ...
_Reader allows filtering and retrieval of Journal entries. Note: this is a low-level interface, and probably not what you want, use systemd.journal.Reader instead.
Argument `flags` sets open flags of the journal, which can be one of, or an ORed combination of constants: LOCAL_ONLY (default) opens journal on local machine only; RUNTIME_ONLY opens only volatile journal files; and SYSTEM opens journal files of system services and the kernel, CURRENT_USER opens files of the current user; and OS_ROOT is used to open the journal from directories relative to the specified directory path or file descriptor.
Instead of opening the system journal, argument `path` may specify a directory which contains the journal. It maybe be either a file system path (a string), or a file descriptor (an integer). Alternatively, argument `files` may specify a list of journal file names. Note that `flags`, `path`, `files`, `directory_fd` are exclusive.