]>
Commit | Line | Data |
---|---|---|
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>· | |
22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 204</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_close, sd_journal, SD_JOURNAL_LOCAL_ONLY, SD_JOURNAL_RUNTIME_ONLY, SD_JOURNAL_SYSTEM_ONLY — Open the system journal for reading</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <systemd/sd-journal.h></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">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="idm259776818528"></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 | |
23 | the log journal for reading. It will find all journal | |
24 | files automatically and interleave them automatically | |
25 | when reading. As first argument it takes a pointer to | |
26 | a <code class="literal">sd_journal</code> pointer, which on | |
27 | success will contain journal context object afterwards. The | |
28 | second argument is a flags field, which may consist of | |
29 | the following flags ORed together: | |
30 | <code class="literal">SD_JOURNAL_LOCAL_ONLY</code> makes sure | |
31 | only journal files generated on the local machine will | |
32 | be opened. <code class="literal">SD_JOURNAL_RUNTIME_ONLY</code> | |
33 | makes sure only volatile journal files will be opened, | |
34 | excluding those which are stored on persistent | |
35 | storage. <code class="literal">SD_JOURNAL_SYSTEM_ONLY</code> | |
36 | will ensure that only journal files of system services | |
37 | and the kernel (in opposition to user session processes) will | |
38 | be opened.</p><p><code class="function">sd_journal_open_directory()</code> | |
39 | is similar to <code class="function">sd_journal_open()</code> | |
40 | but takes an absolute directory path as argument. All | |
41 | journal files in this directory will be opened and | |
42 | interleaved automatically. This call also takes a | |
43 | flags argument, but it must be passed as 0 as no flags | |
44 | are currently understood for this call.</p><p><code class="function">sd_journal_close()</code> will | |
45 | close the journal context allocated with | |
46 | <code class="function">sd_journal_open()</code> or | |
47 | <code class="function">sd_journal_open_directory()</code> and | |
48 | free its resources.</p><p>When opening the journal only journal files | |
49 | accessible to the calling user will be opened. If | |
50 | journal files are not accessible to the caller this | |
51 | will be silently ignored.</p><p>See | |
52 | <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a> | |
53 | for an example how to iterate through the journal | |
54 | after opening it with | |
55 | <code class="function">sd_journal_open()</code>.</p><p>A journal context object returned by | |
56 | <code class="function">sd_journal_open()</code> references a | |
57 | specific journal entry as <span class="emphasis"><em>current</em></span> entry, | |
58 | similar to a file seek index in a classic file system | |
59 | file, but without absolute positions. It may be | |
60 | altered with | |
61 | <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a> | |
62 | and | |
63 | <a href="sd_journal_seek_head.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_seek_head</span>(3)</span></a> | |
64 | and related calls. The current entry position may be | |
65 | exported in <span class="emphasis"><em>cursor</em></span> strings, as accessible | |
66 | via | |
67 | <a href="sd_journal_get_cursor.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_cursor</span>(3)</span></a>. Cursor | |
68 | strings may be used to globally identify a specific | |
69 | journal entry in a stable way and then later to seek | |
70 | to it (or if the specific entry is not available | |
71 | locally, to its closest entry in time) | |
72 | <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 | |
73 | <code class="function">sd_journal_get_fd()</code> and related | |
74 | calls.</p></div><div class="refsect1"><a name="idm259780692640"></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> and | |
75 | <code class="function">sd_journal_open_directory()</code> calls | |
76 | return 0 on success or a negative errno-style error | |
77 | code. <code class="function">sd_journal_close()</code> returns | |
78 | nothing.</p></div><div class="refsect1"><a name="idm259780689152"></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>, | |
79 | <code class="function">sd_journal_open_directory()</code> and | |
80 | <code class="function">sd_journal_close()</code> interfaces are | |
81 | available as shared library, which can be compiled and | |
82 | linked to with the | |
83 | <code class="literal">libsystemd-journal</code> | |
84 | <a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a> | |
85 | file.</p></div><div class="refsect1"><a name="idm259780684064"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> | |
86 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, | |
87 | <a href="sd-journal.html"><span class="citerefentry"><span class="refentrytitle">sd-journal</span>(3)</span></a>, | |
88 | <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>, | |
89 | <a href="sd_journal_get_data.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_data</span>(3)</span></a> | |
90 | </p></div></div></body></html> |