sd_journal_get_cursor

Index

## Name

sd_journal_get_cursor — Get cursor string for the current journal entry

## Synopsis

    #include <systemd/sd-journal.h>

`int sd_journal_get_cursor(` | sd_journal* j,
| char ** cursor`)`;

## Description

`sd_journal_get_cursor()` returns a cursor string for the current journal entry. A cursor is a serialization of the current journal position in text form. The string only contains printable characters and can be passed around in text form. The cursor identifies a journal entry globally and in a stable way and may be used to later seek to it via sd_journal_seek_cursor(3). The cursor string should be considered opaque and not be parsed by clients. Seeking to a cursor position without the specific entry being available locally will seek to the next closest (in terms of time) available entry. The call takes two arguments: a journal context object and a pointer to a string pointer where the cursor string will be placed. The string is allocated via libc malloc(3) and should be freed after use with free(3).

Note that this function will not work before sd_journal_next(3) (or related call) has been called at least once, in order to position the read pointer at a valid entry.

## Return Value

`sd_journal_get_cursor()` returns 0 on success or a negative errno-style error code.

## Notes

The `sd_journal_get_cursor()` interface is available as shared library, which can be compiled and linked to with the `libsystemd-journal` pkg-config(1) file.

## See Also

systemd(1), sd-journal(3), sd_journal_open(3), sd_journal_seek_cursor(3)