1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 Copyright 2012 Lennart Poettering
11 <refentry id=
"sd_journal_get_catalog" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
14 <title>sd_journal_get_catalog
</title>
15 <productname>systemd
</productname>
19 <contrib>Developer
</contrib>
20 <firstname>Lennart
</firstname>
21 <surname>Poettering
</surname>
22 <email>lennart@poettering.net
</email>
28 <refentrytitle>sd_journal_get_catalog
</refentrytitle>
29 <manvolnum>3</manvolnum>
33 <refname>sd_journal_get_catalog
</refname>
34 <refname>sd_journal_get_catalog_for_message_id
</refname>
35 <refpurpose>Retrieve message catalog entry
</refpurpose>
40 <funcsynopsisinfo>#include
<systemd/sd-journal.h
></funcsynopsisinfo>
43 <funcdef>int
<function>sd_journal_get_catalog
</function></funcdef>
44 <paramdef>sd_journal *
<parameter>j
</parameter></paramdef>
45 <paramdef>char **
<parameter>ret
</parameter></paramdef>
49 <funcdef>int
<function>sd_journal_get_catalog_for_message_id
</function></funcdef>
50 <paramdef>sd_id128_t
<parameter>id
</parameter></paramdef>
51 <paramdef>char **
<parameter>ret
</parameter></paramdef>
58 <title>Description
</title>
60 <para><function>sd_journal_get_catalog()
</function> retrieves a
61 message catalog entry for the current journal entry. This will
62 look up an entry in the message catalog by using the
63 <literal>MESSAGE_ID=
</literal> field of the current journal entry.
64 Before returning the entry all journal field names in the catalog
65 entry text enclosed in
"@" will be replaced by the respective
66 field values of the current entry. If a field name referenced in
67 the message catalog entry does not exist, in the current journal
68 entry, the
"@" will be removed, but the field name otherwise left
71 <para><function>sd_journal_get_catalog_for_message_id()
</function>
72 works similar to
<function>sd_journal_get_catalog()
</function> but
73 the entry is looked up by the specified message ID (no open
74 journal context is necessary for this), and no field substitution
77 <para>For more information about the journal message catalog
78 please refer to the
<ulink
79 url=
"https://www.freedesktop.org/wiki/Software/systemd/catalog">Journal
80 Message Catalogs
</ulink> documentation page.
</para>
84 <title>Return Value
</title>
86 <para><function>sd_journal_get_catalog()
</function> and
87 <function>sd_journal_get_catalog_for_message_id()
</function>
88 return
0 on success or a negative errno-style error code. If no
89 matching message catalog entry is found, -ENOENT is
92 <para>On successful return,
<parameter>ret
</parameter> points to a
93 new string, which must be freed with
94 <citerefentry project='man-pages'
><refentrytitle>free
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
101 <para>Function
<function>sd_journal_get_catalog()
</function> is thread-agnostic and only a
102 single thread may operate on a given
<structname>sd_journal
</structname> object. Function
103 <function>sd_journal_get_catalog_for_message_id()
</function> is thread-safe.
</para>
105 <xi:include href=
"libsystemd-pkgconfig.xml" xpointer=
"pkgconfig-text"/>
109 <title>See Also
</title>
112 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>systemd.journal-fields
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
114 <citerefentry><refentrytitle>sd-journal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
115 <citerefentry><refentrytitle>sd_journal_open
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
116 <citerefentry><refentrytitle>sd_journal_next
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
117 <citerefentry><refentrytitle>sd_journal_get_data
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
118 <citerefentry project='man-pages'
><refentrytitle>malloc
</refentrytitle><manvolnum>3</manvolnum></citerefentry>