HALF ECHO LEARN / REFERENCE COLLECTION
v262.2man/journalctl.xml
Git blob: 933d56a38e92efec632dab77ef9363a55aa5860e
Lines 1001–1206 of 1,206
<term><option>--sync</option></term>
<listitem><para>Asks the journal daemon to write all yet unwritten journal data to the backing file
system and synchronize all journals. This call does not return until the synchronization operation
is complete. This command guarantees that any log messages written before its invocation are safely
stored on disk at the time it returns.</para>
<xi:include href="version-info.xml" xpointer="v228"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--relinquish-var</option></term>
<listitem><para>Asks the journal daemon for the reverse operation to <option>--flush</option>: if
requested the daemon will write further log data to <filename>/run/log/journal/</filename> and
stops writing to <filename>/var/log/journal/</filename>. A subsequent call to
<option>--flush</option> causes the log output to switch back to
<filename>/var/log/journal/</filename>, see above.</para>
<xi:include href="version-info.xml" xpointer="v243"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--smart-relinquish-var</option></term>
<listitem><para>Similar to <option>--relinquish-var</option>, but executes no operation if the root
file system and <filename>/var/log/journal/</filename> reside on the same mount point. This operation
is used during system shutdown in order to make the journal daemon stop writing data to
<filename>/var/log/journal/</filename> in case that directory is located on a mount point that needs
to be unmounted.</para>
<xi:include href="version-info.xml" xpointer="v243"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--flush</option></term>
<listitem><para>Asks the journal daemon to flush any log data stored in
<filename>/run/log/journal/</filename> into <filename>/var/log/journal/</filename>, if persistent
storage is enabled. This call does not return until the operation is complete. Note that this call is
idempotent: the data is only flushed from <filename>/run/log/journal/</filename> into
<filename>/var/log/journal/</filename> once during system runtime (but see
<option>--relinquish-var</option> below), and this command exits cleanly without executing any
operation if this has already happened. This command effectively guarantees that all data is flushed
to <filename>/var/log/journal/</filename> at the time it returns.</para>
<xi:include href="version-info.xml" xpointer="v217"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--rotate</option></term>
<listitem><para>Asks the journal daemon to rotate journal files. This call does not return until
the rotation operation is complete. Journal file rotation has the effect that all currently active
journal files are marked as archived and renamed, so that they are never written to in future. New
(empty) journal files are then created in their place. This operation may be combined with
<option>--vacuum-size=</option>, <option>--vacuum-time=</option> and
<option>--vacuum-file=</option> into a single command, see above.</para>
<xi:include href="version-info.xml" xpointer="v227"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--header</option></term>
<listitem><para>Instead of showing journal contents, show internal header information of the
journal fields accessed.</para>
<para>This option is particularly useful when trying to identify out-of-order journal entries, as
happens for example when the machine is booted with the wrong system time.</para>
<xi:include href="version-info.xml" xpointer="v187"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--list-catalog <optional><replaceable>128-bit-ID…</replaceable></optional></option></term>
<listitem><para>List the contents of the message catalog as a table of message IDs, plus their
short description strings.</para>
<para>If any <replaceable>128-bit-ID</replaceable>s are specified, only those entries are
shown.</para>
<xi:include href="version-info.xml" xpointer="v196"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--dump-catalog <optional><replaceable>128-bit-ID…</replaceable></optional></option></term>
<listitem><para>Show the contents of the message catalog, with entries separated by a line
consisting of two dashes and the ID (the format is the same as <filename>.catalog</filename>
files).</para>
<para>If any <replaceable>128-bit-ID</replaceable>s are specified, only those entries are
shown.</para>
<xi:include href="version-info.xml" xpointer="v199"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--update-catalog</option></term>
<listitem><para>Update the message catalog index. This command needs to be executed each time new
catalog files are installed, removed, or updated to rebuild the binary catalog
index.</para>
<xi:include href="version-info.xml" xpointer="v196"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--setup-keys</option></term>
<listitem><para>Instead of showing journal contents, generate a new key pair for Forward Secure
Sealing (FSS). This will generate a sealing key and a verification key. The sealing key is stored in
the journal data directory and shall remain on the host. The verification key should be stored
externally. Refer to the <option>Seal=</option> option in
<citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
information on Forward Secure Sealing and for a link to a refereed scholarly paper detailing the
cryptographic theory it is based on.</para>
<xi:include href="version-info.xml" xpointer="v189"/></listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
</refsect1>
<refsect1>
<title>Exit status</title>
<para>On success, 0 is returned; otherwise, a non-zero failure code is returned.</para>
</refsect1>
<xi:include href="common-variables.xml" />
<refsect1>
<title>Examples</title>
<para>Without arguments, all collected logs are shown unfiltered:</para>
<programlisting>journalctl</programlisting>
<para>With one match specified, all entries with a field matching the expression are shown:</para>
<programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service
journalctl _SYSTEMD_CGROUP=/user.slice/user-42.slice/session-c1.scope</programlisting>
<para>If two different fields are matched, only entries matching both expressions at the same time are
shown:</para>
<programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
<para>If two matches refer to the same field, all entries matching either expression are shown:</para>
<programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
<para>If the separator <literal>+</literal> is used, two expressions may be combined in a logical OR. The
following will show all messages from the Avahi service process with the PID 28097 plus all messages from
the D-Bus service (from any of its processes):</para>
<programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
<para>To show all fields emitted <emphasis>by</emphasis> a unit and <emphasis>about</emphasis> the unit,
option <option>-u</option>/<option>--unit=</option> should be used. <command>journalctl -u
<replaceable>name</replaceable></command> expands to a complex filter similar to
<programlisting>_SYSTEMD_UNIT=<replaceable>name</replaceable>.service
+ UNIT=<replaceable>name</replaceable>.service _PID=1
+ OBJECT_SYSTEMD_UNIT=<replaceable>name</replaceable>.service _UID=0
+ COREDUMP_UNIT=<replaceable>name</replaceable>.service _UID=0 MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1</programlisting>
(see
<citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
for an explanation of those patterns).</para>
<para>Show all logs generated by the D-Bus executable:</para>
<programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
<para>Show all kernel logs from previous boot:</para>
<programlisting>journalctl -k -b -1</programlisting>
<para>Show a live log display from a system service <filename>apache.service</filename>:</para>
<programlisting>journalctl -f -u apache</programlisting>
</refsect1>
<refsect1>
<title>See Also</title>
<para><simplelist type="inline">
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>systemd-cat</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>systemd-journal-remote.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>systemd-journal-upload.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
</simplelist></para>
</refsect1>
</refentry>