1SD-JOURNAL(3) sd-journal SD-JOURNAL(3)
2
3
4
6 sd-journal - APIs for submitting and querying log entries to and from
7 the journal
8
10 #include <systemd/sd-journal.h>
11
12 pkg-config --cflags --libs libsystemd
13
15 sd-journal.h is part of libsystemd(3) and provides APIs to submit and
16 query log entries. The APIs exposed act both as client for the systemd-
17 journald.service(8) journal service and as parser for the journal files
18 on disk.
19
20 See sd_journal_print(3), sd_journal_stream_fd(3), sd_journal_open(3),
21 sd_journal_next(3), sd_journal_get_realtime_usec(3),
22 sd_journal_add_match(3), sd_journal_seek_head(3),
23 sd_journal_enumerate_fields(3), sd_journal_get_cursor(3),
24 sd_journal_get_cutoff_realtime_usec(3),
25 sd_journal_get_cutoff_monotonic_usec(3), sd_journal_get_usage(3),
26 sd_journal_get_catalog(3), sd_journal_get_fd(3),
27 sd_journal_has_runtime_files(3) and sd_journal_has_persistent_files(3)
28 for more information about the functions implemented.
29
30 Command line access for submitting entries to the journal is available
31 with the systemd-cat(1) tool. Command line access for querying entries
32 from the journal is available with the journalctl(1) tool.
33
35 Functions that operate on sd_journal objects are thread agnostic —
36 given sd_journal pointer may only be used from one specific thread at
37 all times (and it has to be the very same one during the entire
38 lifetime of the object), but multiple, independent threads may use
39 multiple, independent objects safely. Other functions — those that are
40 used to send entries to the journal, like sd_journal_print(3) and
41 similar, or those that are used to retrieve global information like
42 sd_journal_stream_fd(3) and sd_journal_get_catalog_for_message_id(3) —
43 are fully thread-safe and may be called from multiple threads in
44 parallel.
45
47 Functions described here are available as a shared library, which can
48 be compiled against and linked to with the libsystemd pkg-config(1)
49 file.
50
51 The code described here uses getenv(3), which is declared to be not
52 multi-thread-safe. This means that the code calling the functions
53 described here must not call setenv(3) from a parallel thread. It is
54 recommended to only do calls to setenv() from an early phase of the
55 program when no other threads have been started.
56
58 systemd(1), sd_journal_print(3), sd_journal_stream_fd(3),
59 sd_journal_open(3), sd_journal_next(3), sd_journal_get_data(3),
60 sd_journal_get_realtime_usec(3), sd_journal_add_match(3),
61 sd_journal_seek_head(3), sd_journal_enumerate_fields(3),
62 sd_journal_get_cursor(3), sd_journal_get_cutoff_realtime_usec(3),
63 sd_journal_get_cutoff_monotonic_usec(3), sd_journal_get_usage(3),
64 sd_journal_get_fd(3), sd_journal_query_unique(3),
65 sd_journal_get_catalog(3), sd_journal_has_runtime_files(3),
66 sd_journal_has_persistent_files(3), journalctl(1), sd-id128(3), pkg-
67 config(1)
68
69
70
71systemd 254 SD-JOURNAL(3)