1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2012 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="journalctl">
27 <title>journalctl</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>journalctl</refentrytitle>
42 <manvolnum>1</manvolnum>
46 <refname>journalctl</refname>
47 <refpurpose>Query the systemd journal</refpurpose>
52 <command>journalctl <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt">MATCH</arg></command>
57 <title>Description</title>
59 <para><command>journalctl</command> may be used to
60 query the contents of the
61 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
63 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
65 <para>If called without parameter will show the full
66 contents of the journal, starting with the oldest
67 entry collected.</para>
69 <para>If a match argument is passed the output is
70 filtered accordingly. A match is in the format
71 <literal>FIELD=VALUE</literal>,
72 e.g. <literal>_SYSTEMD_UNIT=httpd.service</literal>. See
73 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
74 for a list of well-known fields.</para>
76 <para>Output is interleaved from all accessible
77 journal files, whether they are rotated or currently
78 being written, and regardless whether they belong to the
79 system itself or are accessible user journals.</para>
81 <para>All users are granted access to their private
82 per-user journals. However, by default only root and
83 users who are members of the <literal>adm</literal>
84 group get access to the system journal and the
85 journals of other users.</para>
89 <title>Options</title>
91 <para>The following options are understood:</para>
95 <term><option>--help</option></term>
96 <term><option>-h</option></term>
98 <listitem><para>Prints a short help
99 text and exits.</para></listitem>
103 <term><option>--version</option></term>
105 <listitem><para>Prints a short version
106 string and exits.</para></listitem>
110 <term><option>--no-pager</option></term>
112 <listitem><para>Do not pipe output into a
113 pager.</para></listitem>
117 <term><option>--all</option></term>
118 <term><option>-a</option></term>
120 <listitem><para>Show all fields in
121 full, even if they include unprintable
122 characters or are very
123 long.</para></listitem>
127 <term><option>--follow</option></term>
128 <term><option>-f</option></term>
130 <listitem><para>Show only most recent
131 journal entries, and continously print
132 new entries as they are appended to
133 the journal.</para></listitem>
137 <term><option>--lines=</option></term>
138 <term><option>-n</option></term>
140 <listitem><para>Controls the number of
141 journal lines to show, counting from
142 the most recent ones. Takes a positive
143 integer argument. In follow mode
144 defaults to 10, otherwise is unset
145 thus not limiting how many lines are
146 shown.</para></listitem>
150 <term><option>--no-tail</option></term>
152 <listitem><para>Show all stored output
153 lines, even in follow mode. Undoes the
155 <option>--lines=</option>.</para></listitem>
159 <term><option>--output=</option></term>
160 <term><option>-o</option></term>
162 <listitem><para>Controls the
163 formatting of the journal entries that are
165 <literal>short</literal>,
166 <literal>short-monotonic</literal>,
167 <literal>verbose</literal>,
168 <literal>export</literal>,
169 <literal>json</literal>,
170 <literal>cat</literal>. <literal>short</literal>
171 is the default and generates an output
172 that is mostly identical to the
173 formatting of classic syslog log
174 files, showing one line per journal
175 entry. <literal>short-monotonic</literal>
176 is very similar but shows monotonic
177 timestamps instead of wallclock
178 timestamps. <literal>verbose</literal>
179 shows the full structered entry items
181 fiels. <literal>export</literal>
182 serializes the journal into a binary
183 (but mostly text-based) stream
184 suitable for backups and network
185 transfer. <literal>json</literal>
186 formats entries as JSON data
187 structures. <literal>cat</literal>
188 generates a very terse output only
189 showing the actual message of each
190 journal entry with no meta data, not
191 even a timestamp.</para></listitem>
195 <term><option>--quiet</option></term>
196 <term><option>-q</option></term>
198 <listitem><para>Suppresses any warning
199 message regarding inaccessable system
200 journals when run as normal
201 user.</para></listitem>
205 <term><option>--local</option></term>
206 <term><option>-l</option></term>
208 <listitem><para>Show only locally
209 generated messages.</para></listitem>
213 <term><option>--new-id128</option></term>
215 <listitem><para>Instead of showing
216 journal contents generate a new 128
217 bit ID suitable for identifying
218 messages. This is intended for usage
219 by developers who need a new
220 identifier for a new message they
221 introduce and want to make
222 recognizable. Will print the new ID in
223 three different formats which can be
224 copied into source code or
225 similar.</para></listitem>
232 <title>Exit status</title>
234 <para>On success 0 is returned, a non-zero failure
235 code otherwise.</para>
239 <title>Environment</title>
243 <term><varname>$SYSTEMD_PAGER</varname></term>
244 <listitem><para>Pager to use when
245 <option>--no-pager</option> is not given;
246 overrides <varname>$PAGER</varname>. Setting
247 this to an empty string or the value
248 <literal>cat</literal> is equivalent to passing
249 <option>--no-pager</option>.</para></listitem>
255 <title>See Also</title>
257 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
258 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
259 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
260 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
261 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>