]>
Commit | Line | Data |
---|---|---|
f2cf0403 LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
f2cf0403 LP |
4 | |
5 | <!-- | |
572eb058 ZJS |
6 | SPDX-License-Identifier: LGPL-2.1+ |
7 | ||
f2cf0403 LP |
8 | This file is part of systemd. |
9 | ||
10 | Copyright 2012 Lennart Poettering | |
f2cf0403 LP |
11 | --> |
12 | ||
13 | <refentry id="sd_journal_get_catalog"> | |
14 | ||
798d3a52 ZJS |
15 | <refentryinfo> |
16 | <title>sd_journal_get_catalog</title> | |
17 | <productname>systemd</productname> | |
18 | ||
19 | <authorgroup> | |
20 | <author> | |
21 | <contrib>Developer</contrib> | |
22 | <firstname>Lennart</firstname> | |
23 | <surname>Poettering</surname> | |
24 | <email>lennart@poettering.net</email> | |
25 | </author> | |
26 | </authorgroup> | |
27 | </refentryinfo> | |
28 | ||
29 | <refmeta> | |
30 | <refentrytitle>sd_journal_get_catalog</refentrytitle> | |
31 | <manvolnum>3</manvolnum> | |
32 | </refmeta> | |
33 | ||
34 | <refnamediv> | |
35 | <refname>sd_journal_get_catalog</refname> | |
36 | <refname>sd_journal_get_catalog_for_message_id</refname> | |
37 | <refpurpose>Retrieve message catalog entry</refpurpose> | |
38 | </refnamediv> | |
39 | ||
40 | <refsynopsisdiv> | |
41 | <funcsynopsis> | |
42 | <funcsynopsisinfo>#include <systemd/sd-journal.h></funcsynopsisinfo> | |
43 | ||
44 | <funcprototype> | |
45 | <funcdef>int <function>sd_journal_get_catalog</function></funcdef> | |
46 | <paramdef>sd_journal *<parameter>j</parameter></paramdef> | |
47 | <paramdef>char **<parameter>ret</parameter></paramdef> | |
48 | </funcprototype> | |
49 | ||
50 | <funcprototype> | |
51 | <funcdef>int <function>sd_journal_get_catalog_for_message_id</function></funcdef> | |
52 | <paramdef>sd_id128_t <parameter>id</parameter></paramdef> | |
53 | <paramdef>char **<parameter>ret</parameter></paramdef> | |
54 | </funcprototype> | |
55 | ||
798d3a52 ZJS |
56 | </funcsynopsis> |
57 | </refsynopsisdiv> | |
58 | ||
59 | <refsect1> | |
60 | <title>Description</title> | |
61 | ||
62 | <para><function>sd_journal_get_catalog()</function> retrieves a | |
63 | message catalog entry for the current journal entry. This will | |
64 | look up an entry in the message catalog by using the | |
65 | <literal>MESSAGE_ID=</literal> field of the current journal entry. | |
66 | Before returning the entry all journal field names in the catalog | |
67 | entry text enclosed in "@" will be replaced by the respective | |
68 | field values of the current entry. If a field name referenced in | |
69 | the message catalog entry does not exist, in the current journal | |
70 | entry, the "@" will be removed, but the field name otherwise left | |
71 | untouched.</para> | |
72 | ||
73 | <para><function>sd_journal_get_catalog_for_message_id()</function> | |
74 | works similar to <function>sd_journal_get_catalog()</function> but | |
75 | the entry is looked up by the specified message ID (no open | |
76 | journal context is necessary for this), and no field substitution | |
77 | is performed.</para> | |
78 | ||
79 | <para>For more information about the journal message catalog | |
80 | please refer to the <ulink | |
28a0ad81 | 81 | url="https://www.freedesktop.org/wiki/Software/systemd/catalog">Journal |
798d3a52 ZJS |
82 | Message Catalogs</ulink> documentation page.</para> |
83 | </refsect1> | |
84 | ||
85 | <refsect1> | |
86 | <title>Return Value</title> | |
87 | ||
88 | <para><function>sd_journal_get_catalog()</function> and | |
89 | <function>sd_journal_get_catalog_for_message_id()</function> | |
90 | return 0 on success or a negative errno-style error code. If no | |
91 | matching message catalog entry is found, -ENOENT is | |
92 | returned.</para> | |
93 | ||
94 | <para>On successful return, <parameter>ret</parameter> points to a | |
95 | new string, which must be freed with | |
96 | <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
97 | </para> | |
98 | </refsect1> | |
99 | ||
100 | <refsect1> | |
101 | <title>Notes</title> | |
102 | ||
a8d46a16 ZJS |
103 | <para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only a |
104 | single thread may operate on a given <structname>sd_journal</structname> object. Function | |
77d3bb12 | 105 | <function>sd_journal_get_catalog_for_message_id()</function> is thread-safe.</para> |
a8d46a16 | 106 | |
798d3a52 ZJS |
107 | <para>The <function>sd_journal_get_catalog()</function> and |
108 | <function>sd_journal_get_catalog_for_message_id()</function> | |
109 | interfaces are available as a shared library, which can be | |
110 | compiled and linked to with the | |
111 | <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
112 | file.</para> | |
113 | </refsect1> | |
114 | ||
115 | <refsect1> | |
116 | <title>See Also</title> | |
117 | ||
118 | <para> | |
119 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
120 | <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
121 | <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
122 | <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
123 | <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
124 | <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
3ba3a79d | 125 | <citerefentry project='man-pages'><refentrytitle>malloc</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
798d3a52 ZJS |
126 | </para> |
127 | </refsect1> | |
f2cf0403 LP |
128 | |
129 | </refentry> |