]> git.proxmox.com Git - systemd.git/blame - man/SD_JOURNAL_RUNTIME_ONLY.html
Imported Upstream version 219
[systemd.git] / man / SD_JOURNAL_RUNTIME_ONLY.html
CommitLineData
663996b3
MS
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_journal_open</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
e735f4d4
MP
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="sd_journal_open"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_journal_open, sd_journal_open_directory, sd_journal_open_files, sd_journal_open_container, sd_journal_close, sd_journal, SD_JOURNAL_LOCAL_ONLY, SD_JOURNAL_RUNTIME_ONLY, SD_JOURNAL_SYSTEM, SD_JOURNAL_CURRENT_USER — Open the system journal for reading</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-journal.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_journal_open</b>(</code></td><td>sd_journal **<var class="pdparam">ret</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_journal_open_directory</b>(</code></td><td>sd_journal **<var class="pdparam">ret</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">path</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_journal_open_files</b>(</code></td><td>sd_journal **<var class="pdparam">ret</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">paths</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_journal_open_container</b>(</code></td><td>sd_journal **<var class="pdparam">ret</var>, </td></tr><tr><td> </td><td>const char *<var class="pdparam">machine</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">sd_journal_close</b>(</code></td><td>sd_journal *<var class="pdparam">j</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm140423144980192"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_journal_open()</code> opens the log journal
23 for reading. It will find all journal files automatically and
24 interleave them automatically when reading. As first argument it
25 takes a pointer to a <code class="varname">sd_journal</code> pointer, which
26 on success will contain a journal context object. The second
27 argument is a flags field, which may consist of the following
28 flags ORed together: <code class="constant">SD_JOURNAL_LOCAL_ONLY</code>
29 makes sure only journal files generated on the local machine will
30 be opened. <code class="constant">SD_JOURNAL_RUNTIME_ONLY</code> makes sure
31 only volatile journal files will be opened, excluding those which
32 are stored on persistent storage.
33 <code class="constant">SD_JOURNAL_SYSTEM</code> will cause journal files of
34 system services and the kernel (in opposition to user session
35 processes) to be opened.
36 <code class="constant">SD_JOURNAL_CURRENT_USER</code> will cause journal
37 files of the current user to be opened. If neither
38 <code class="constant">SD_JOURNAL_SYSTEM</code> nor
39 <code class="constant">SD_JOURNAL_CURRENT_USER</code> are specified, all
40 journal file types will be opened.</p><p><code class="function">sd_journal_open_directory()</code> is similar
41 to <code class="function">sd_journal_open()</code> but takes an absolute
42 directory path as argument. All journal files in this directory
43 will be opened and interleaved automatically. This call also takes
44 a flags argument, but it must be passed as 0 as no flags are
45 currently understood for this call.</p><p><code class="function">sd_journal_open_files()</code> is similar to
46 <code class="function">sd_journal_open()</code> but takes a
47 <code class="constant">NULL</code>-terminated list of file paths to open.
48 All files will be opened and interleaved automatically. This call
49 also takes a flags argument, but it must be passed as 0 as no
50 flags are currently understood for this call. Please note that in
51 the case of a live journal, this function is only useful for
52 debugging, because individual journal files can be rotated at any
53 moment, and the opening of specific files is inherently
54 racy.</p><p><code class="function">sd_journal_open_container()</code> is similar
55 to <code class="function">sd_journal_open()</code> but opens the journal
56 files of a running OS container. The specified machine name refers
57 to a container that is registered with
58 <a href="systemd-machined.html"><span class="citerefentry"><span class="refentrytitle">systemd-machined</span>(8)</span></a>.</p><p><code class="varname">sd_journal</code> objects cannot be used in the
59 child after a fork. Functions which take a journal object as an
60 argument (<code class="function">sd_journal_next()</code> and others) will
61 return <code class="constant">-ECHILD</code> after a fork.
62 </p><p><code class="function">sd_journal_close()</code> will close the
63 journal context allocated with
64 <code class="function">sd_journal_open()</code> or
65 <code class="function">sd_journal_open_directory()</code> and free its
66 resources.</p><p>When opening the journal only journal files accessible to
67 the calling user will be opened. If journal files are not
68 accessible to the caller, this will be silently ignored.</p><p>See
69 <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
70 for an example of how to iterate through the journal after opening
71 it with <code class="function">sd_journal_open()</code>.</p><p>A journal context object returned by
72 <code class="function">sd_journal_open()</code> references a specific
73 journal entry as <span class="emphasis"><em>current</em></span> entry, similar to a
74 file seek index in a classic file system file, but without
75 absolute positions. It may be altered with
76 <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>
77 and
78 <a href="sd_journal_seek_head.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_seek_head</span>(3)</span></a>
79 and related calls. The current entry position may be exported in
80 <span class="emphasis"><em>cursor</em></span> strings, as accessible via
81 <a href="sd_journal_get_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_cursor</span>(3)</span></a>.
82 Cursor strings may be used to globally identify a specific journal
83 entry in a stable way and then later to seek to it (or if the
84 specific entry is not available locally, to its closest entry in
85 time)
86 <a href="sd_journal_seek_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_seek_cursor</span>(3)</span></a>.</p><p>Notification of journal changes is available via
87 <code class="function">sd_journal_get_fd()</code> and related calls.</p></div><div class="refsect1"><a name="idm140423144946896"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p>The <code class="function">sd_journal_open()</code>,
88 <code class="function">sd_journal_open_directory()</code>, and
89 <code class="function">sd_journal_open_files()</code> calls return 0 on
90 success or a negative errno-style error code.
91 <code class="function">sd_journal_close()</code> returns nothing.</p></div><div class="refsect1"><a name="idm140423144942720"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_journal_open()</code>,
92 <code class="function">sd_journal_open_directory()</code> and
93 <code class="function">sd_journal_close()</code> interfaces are available
94 as a shared library, which can be compiled and linked to with the
95 <code class="constant">libsystemd</code> <a href="http://linux.die.net/man/1/pkg-config"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
96 file.</p></div><div class="refsect1"><a name="idm140423139973184"></a><h2 id="History">History<a class="headerlink" title="Permalink to this headline" href="#History">¶</a></h2><p><code class="function">sd_journal_open()</code>,
97 <code class="function">sd_journal_close()</code>,
98 <code class="constant">SD_JOURNAL_LOCAL_ONLY</code>,
99 <code class="constant">SD_JOURNAL_RUNTIME_ONLY</code>,
100 <code class="constant">SD_JOURNAL_SYSTEM_ONLY</code> were added in
101 systemd-38.</p><p><code class="function">sd_journal_open_directory()</code> was added
102 in systemd-187.</p><p><code class="constant">SD_JOURNAL_SYSTEM</code>,
103 <code class="constant">SD_JOURNAL_CURRENT_USER</code>, and
104 <code class="function">sd_journal_open_files()</code> were added in
105 systemd-205. <code class="constant">SD_JOURNAL_SYSTEM_ONLY</code> was
106 deprecated.</p></div><div class="refsect1"><a name="idm140423139966848"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
107 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
108 <a href="sd-journal.html"><span class="citerefentry"><span class="refentrytitle">sd-journal</span>(3)</span></a>,
109 <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>,
110 <a href="sd_journal_get_data.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_data</span>(3)</span></a>,
111 <a href="systemd-machined.html"><span class="citerefentry"><span class="refentrytitle">systemd-machined</span>(8)</span></a>
112 </p></div></div></body></html>