| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="sd_journal_get_catalog" xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 7 |
|
| 8 |
<refentryinfo> |
| 9 |
<title>sd_journal_get_catalog</title> |
| 10 |
<productname>systemd</productname> |
| 11 |
</refentryinfo> |
| 12 |
|
| 13 |
<refmeta> |
| 14 |
<refentrytitle>sd_journal_get_catalog</refentrytitle> |
| 15 |
<manvolnum>3</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>sd_journal_get_catalog</refname> |
| 20 |
<refname>sd_journal_get_catalog_for_message_id</refname> |
| 21 |
<refpurpose>Retrieve message catalog entry</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<funcsynopsis> |
| 26 |
<funcsynopsisinfo>#include <systemd/sd-journal.h></funcsynopsisinfo> |
| 27 |
|
| 28 |
<funcprototype> |
| 29 |
<funcdef>int <function>sd_journal_get_catalog</function></funcdef> |
| 30 |
<paramdef>sd_journal *<parameter>j</parameter></paramdef> |
| 31 |
<paramdef>char **<parameter>ret</parameter></paramdef> |
| 32 |
</funcprototype> |
| 33 |
|
| 34 |
<funcprototype> |
| 35 |
<funcdef>int <function>sd_journal_get_catalog_for_message_id</function></funcdef> |
| 36 |
<paramdef>sd_id128_t <parameter>id</parameter></paramdef> |
| 37 |
<paramdef>char **<parameter>ret</parameter></paramdef> |
| 38 |
</funcprototype> |
| 39 |
|
| 40 |
</funcsynopsis> |
| 41 |
</refsynopsisdiv> |
| 42 |
|
| 43 |
<refsect1> |
| 44 |
<title>Description</title> |
| 45 |
|
| 46 |
<para><function>sd_journal_get_catalog()</function> retrieves a |
| 47 |
message catalog entry for the current journal entry. This will |
| 48 |
look up an entry in the message catalog by using the |
| 49 |
<literal>MESSAGE_ID=</literal> field of the current journal entry. |
| 50 |
Before returning the entry all journal field names in the catalog |
| 51 |
entry text enclosed in "@" will be replaced by the respective |
| 52 |
field values of the current entry. If a field name referenced in |
| 53 |
the message catalog entry does not exist, in the current journal |
| 54 |
entry, the "@" will be removed, but the field name otherwise left |
| 55 |
untouched.</para> |
| 56 |
|
| 57 |
<para><function>sd_journal_get_catalog_for_message_id()</function> |
| 58 |
works similar to <function>sd_journal_get_catalog()</function> but |
| 59 |
the entry is looked up by the specified message ID (no open |
| 60 |
journal context is necessary for this), and no field substitution |
| 61 |
is performed.</para> |
| 62 |
|
| 63 |
<para>For more information about the journal message catalog |
| 64 |
please refer to the <ulink |
| 65 |
url="https://systemd.io/CATALOG">Journal |
| 66 |
Message Catalogs</ulink> documentation page.</para> |
| 67 |
</refsect1> |
| 68 |
|
| 69 |
<refsect1> |
| 70 |
<title>Return Value</title> |
| 71 |
|
| 72 |
<para><function>sd_journal_get_catalog()</function> and |
| 73 |
<function>sd_journal_get_catalog_for_message_id()</function> |
| 74 |
return 0 on success or a negative errno-style error code. If no |
| 75 |
matching message catalog entry is found, -ENOENT is |
| 76 |
returned.</para> |
| 77 |
|
| 78 |
<para>On successful return, <parameter>ret</parameter> points to a |
| 79 |
new string, which must be freed with |
| 80 |
<citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>. |
| 81 |
</para> |
| 82 |
</refsect1> |
| 83 |
|
| 84 |
<refsect1> |
| 85 |
<title>Notes</title> |
| 86 |
|
| 87 |
<para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only a single thread |
| 88 |
may operate on a given object at any given time. Multiple independent objects may be used from different |
| 89 |
threads in parallel.</para> |
| 90 |
|
| 91 |
<para>Function <function>sd_journal_get_catalog_for_message_id()</function> is thread-safe and may be |
| 92 |
called from multiple threads in parallel.</para> |
| 93 |
|
| 94 |
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/> |
| 95 |
</refsect1> |
| 96 |
|
| 97 |
<refsect1> |
| 98 |
<title>History</title> |
| 99 |
<para><function>sd_journal_get_catalog()</function> and |
| 100 |
<function>sd_journal_get_catalog_for_message_id()</function> were added in version 196.</para> |
| 101 |
</refsect1> |
| 102 |
|
| 103 |
<refsect1> |
| 104 |
<title>See Also</title> |
| 105 |
|
| 106 |
<para><simplelist type="inline"> |
| 107 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 108 |
<member><citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 109 |
<member><citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 110 |
<member><citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 111 |
<member><citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 112 |
<member><citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 113 |
<member><citerefentry project='man-pages'><refentrytitle>malloc</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 114 |
</simplelist></para> |
| 115 |
</refsect1> |
| 116 |
|
| 117 |
</refentry> |