1SD_JOURNAL_GET_CATALOG(3) sd_journal_get_catalog SD_JOURNAL_GET_CATALOG(3)
2
3
4
6 sd_journal_get_catalog, sd_journal_get_catalog_for_message_id -
7 Retrieve message catalog entry
8
10 #include <systemd/sd-journal.h>
11
12 int sd_journal_get_catalog(sd_journal *j, char **ret);
13
14 int sd_journal_get_catalog_for_message_id(sd_id128_t id, char **ret);
15
17 sd_journal_get_catalog() retrieves a message catalog entry for the
18 current journal entry. This will look up an entry in the message
19 catalog by using the "MESSAGE_ID=" field of the current journal entry.
20 Before returning the entry all journal field names in the catalog entry
21 text enclosed in "@" will be replaced by the respective field values of
22 the current entry. If a field name referenced in the message catalog
23 entry does not exist, in the current journal entry, the "@" will be
24 removed, but the field name otherwise left untouched.
25
26 sd_journal_get_catalog_for_message_id() works similar to
27 sd_journal_get_catalog() but the entry is looked up by the specified
28 message ID (no open journal context is necessary for this), and no
29 field substitution is performed.
30
31 For more information about the journal message catalog please refer to
32 the Journal Message Catalogs[1] documentation page.
33
35 sd_journal_get_catalog() and sd_journal_get_catalog_for_message_id()
36 return 0 on success or a negative errno-style error code. If no
37 matching message catalog entry is found, -ENOENT is returned.
38
39 On successful return, ret points to a new string, which must be freed
40 with free(3).
41
43 Function sd_journal_get_catalog() is thread-agnostic and only a single
44 specific thread may operate on a given object during its entire
45 lifetime. It's safe to allocate multiple independent objects and use
46 each from a specific thread in parallel. However, it's not safe to
47 allocate such an object in one thread, and operate or free it from any
48 other, even if locking is used to ensure these threads don't operate on
49 it at the very same time.
50
51 Function sd_journal_get_catalog_for_message_id() is are thread-safe and
52 may be called in parallel from multiple threads.
53
54 These APIs are implemented as a shared library, which can be compiled
55 and linked to with the libsystemd pkg-config(1) file.
56
58 systemd(1), systemd.journal-fields(7), sd-journal(3),
59 sd_journal_open(3), sd_journal_next(3), sd_journal_get_data(3),
60 malloc(3)
61
63 1. Journal Message Catalogs
64 https://www.freedesktop.org/wiki/Software/systemd/catalog
65
66
67
68systemd 248 SD_JOURNAL_GET_CATALOG(3)