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" rep="repeat">MATCHES</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 it will show the full
66 contents of the journal, starting with the oldest
67 entry collected.</para>
69 <para>If one or more match arguments are passed the
70 output is filtered accordingly. A match is in the
71 format <literal>FIELD=VALUE</literal>,
72 e.g. <literal>_SYSTEMD_UNIT=httpd.service</literal>,
73 referring to the components of a structured journal
75 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
76 for a list of well-known fields. If multiple matches
77 are specified matching different fields the log
78 entries are filtered by both, i.e. the resulting output
79 will show only entries matching all the specified
80 matches of this kind. If two matches apply to the same
81 field, then they are automatically matched as
82 alternatives, i.e. the resulting output will show
83 entries matching any of the specified matches for the
84 same field. Finally, if the character
85 "<literal>+</literal>" appears as separate word on the
86 command line all matches before and after are combined
87 in a disjunction (i.e. logical OR).</para>
89 <para>As shortcuts for a few types of field/value
90 matches file paths may be specified. If a file path
91 refers to an executable file, this is equivalent to an
92 <literal>_EXE=</literal> match for the canonicalized
93 binary path. Similar, if a path refers to a device
94 node, this is equivalent to a
95 <literal>_KERNEL_DEVICE=</literal> match for the
98 <para>Output is interleaved from all accessible
99 journal files, whether they are rotated or currently
100 being written, and regardless whether they belong to the
101 system itself or are accessible user journals.</para>
103 <para>All users are granted access to their private
104 per-user journals. However, by default only root and
105 users who are members of the <literal>adm</literal>
106 group get access to the system journal and the
107 journals of other users.</para>
111 <title>Options</title>
113 <para>The following options are understood:</para>
117 <term><option>--help</option></term>
118 <term><option>-h</option></term>
120 <listitem><para>Prints a short help
121 text and exits.</para></listitem>
125 <term><option>--version</option></term>
127 <listitem><para>Prints a short version
128 string and exits.</para></listitem>
132 <term><option>--no-pager</option></term>
134 <listitem><para>Do not pipe output into a
135 pager.</para></listitem>
139 <term><option>--all</option></term>
140 <term><option>-a</option></term>
142 <listitem><para>Show all fields in
143 full, even if they include unprintable
144 characters or are very
145 long.</para></listitem>
149 <term><option>--follow</option></term>
150 <term><option>-f</option></term>
152 <listitem><para>Show only the most recent
153 journal entries, and continuously print
154 new entries as they are appended to
155 the journal.</para></listitem>
159 <term><option>--lines=</option></term>
160 <term><option>-n</option></term>
162 <listitem><para>Show the most recent
163 journal events and limit the number of
165 <option>--follow</option> is used,
166 this option is implied. The argument,
167 a positive integer, is optional, and
168 defaults to 10. </para></listitem>
172 <term><option>--no-tail</option></term>
174 <listitem><para>Show all stored output
175 lines, even in follow mode. Undoes the
177 <option>--lines=</option>.</para></listitem>
181 <term><option>--output=</option></term>
182 <term><option>-o</option></term>
184 <listitem><para>Controls the
185 formatting of the journal entries that
186 are shown. Takes one of
187 <literal>short</literal>,
188 <literal>short-monotonic</literal>,
189 <literal>verbose</literal>,
190 <literal>export</literal>,
191 <literal>json</literal>,
192 <literal>json-pretty</literal>,
193 <literal>json-sse</literal>,
194 <literal>cat</literal>. <literal>short</literal>
195 is the default and generates an output
196 that is mostly identical to the
197 formatting of classic syslog log
198 files, showing one line per journal
199 entry. <literal>short-monotonic</literal>
200 is very similar but shows monotonic
201 timestamps instead of wallclock
202 timestamps. <literal>verbose</literal>
203 shows the full structured entry items
205 fields. <literal>export</literal>
206 serializes the journal into a binary
207 (but mostly text-based) stream
208 suitable for backups and network
210 url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
211 Export Format</ulink> for more
212 information). <literal>json</literal>
213 formats entries as JSON data
216 url="http://www.freedesktop.org/wiki/Software/systemd/json">Journal
217 JSON Format</ulink> for more
218 information). <literal>json-pretty</literal>
219 also formats entries as JSON data
220 structures, but formats them in
221 multiple lines in order to make them
223 humans. <literal>json-sse</literal>
224 also formats entries as JSON data
225 structures, but wraps them in a format
227 url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events">Server-Sent
228 Events</ulink>. <literal>cat</literal>
229 generates a very terse output only
230 showing the actual message of each
231 journal entry with no meta data, not
232 even a timestamp.</para></listitem>
236 <term><option>--catalog</option></term>
237 <term><option>-x</option></term>
239 <listitem><para>Augment log lines with
240 explanation texts from the message
241 catalog. This will add explanatory
242 help texts to log messages in the
243 output where this is available. These
244 short help texts will explain the
245 context of an error or log event,
246 possible solutions, as well as
247 pointers to support forums, developer
248 documentation and any other relevant
249 manuals. Note that help texts are not
250 available for all messages but only
251 for selected ones.</para></listitem>
255 <term><option>--quiet</option></term>
256 <term><option>-q</option></term>
258 <listitem><para>Suppresses any warning
259 message regarding inaccessible system
260 journals when run as normal
261 user.</para></listitem>
265 <term><option>--merge</option></term>
266 <term><option>-m</option></term>
268 <listitem><para>Show entries
269 interleaved from all available
270 journals, including remote
271 ones.</para></listitem>
275 <term><option>--this-boot</option></term>
276 <term><option>-b</option></term>
278 <listitem><para>Show data only from
279 current boot. This will add a match
280 for <literal>_BOOT_ID=</literal> for
281 the current boot ID of the
282 kernel.</para></listitem>
286 <term><option>--unit=</option></term>
287 <term><option>-u</option></term>
289 <listitem><para>Show data only of the
290 specified unit. This will add a match
291 for <literal>_SYSTEMD_UNIT=</literal>
293 unit.</para></listitem>
297 <term><option>-p</option></term>
298 <term><option>--priority=</option></term>
300 <listitem><para>Filter output by
301 message priorities or priority
302 ranges. Takes either a single numeric
303 or textual log level (i.e. between
304 0/<literal>emerg</literal> and
305 7/<literal>debug</literal>), or a
306 range of numeric/text log levels in
307 the form FROM..TO. The log levels are
308 the usual syslog log levels as
310 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
311 i.e. <literal>emerg</literal> (0),
312 <literal>alert</literal> (1),
313 <literal>crit</literal> (2),
314 <literal>err</literal> (3),
315 <literal>warning</literal> (4),
316 <literal>notice</literal> (5),
317 <literal>info</literal> (6),
318 <literal>debug</literal> (7). If a
319 single log level is specified all
320 messages with this log level or a
321 lower (hence more important) log level
322 are shown. If a range is specified all
323 messages within the range are shown,
324 including both the start and the end
325 value of the range. This will add
326 <literal>PRIORITY=</literal> matches
328 priorities.</para></listitem>
332 <term><option>--cursor=</option></term>
333 <term><option>-c</option></term>
335 <listitem><para>Start showing entries
336 from the location in the journal
337 specified by the passed
338 cursor.</para></listitem>
342 <term><option>--since=</option></term>
343 <term><option>--until=</option></term>
345 <listitem><para>Start showing entries
346 on or newer than the specified date,
347 or on or older than the specified
348 date, respectively. Date specifications should be of
349 the format "2012-10-30 18:17:16". If
350 the time part is omitted, 00:00:00 is
351 assumed. If only the seconds component
352 is omitted, :00 is assumed. If the
353 date component is ommitted, the
354 current day is assumed. Alternatively
356 <literal>yesterday</literal>,
357 <literal>today</literal>,
358 <literal>tomorrow</literal> are
359 understood, which refer to 00:00:00 of
360 the day before the current day, the
361 current day, or the day after the
362 current day, respectively. <literal>now</literal>
363 refers to the current time. Finally,
364 relative times may be specified,
365 prefixed with <literal>-</literal> or
366 <literal>+</literal>, referring to
367 times before or after the current
368 time, respectively.</para></listitem>
372 <term><option>--field=</option></term>
373 <term><option>-F</option></term>
375 <listitem><para>Print all possible
376 data values the specified field can
377 take in all entries of the
378 journal.</para></listitem>
382 <term><option>--directory=</option></term>
383 <term><option>-D</option></term>
385 <listitem><para>Takes an absolute
386 directory path as argument. If
387 specified journalctl will operate on the
388 specified journal directory instead of
389 the default runtime and system journal
390 paths.</para></listitem>
394 <term><option>--new-id128</option></term>
396 <listitem><para>Instead of showing
397 journal contents generate a new 128
398 bit ID suitable for identifying
399 messages. This is intended for usage
400 by developers who need a new
401 identifier for a new message they
402 introduce and want to make
403 recognizable. Will print the new ID in
404 three different formats which can be
405 copied into source code or
406 similar.</para></listitem>
410 <term><option>--header</option></term>
412 <listitem><para>Instead of showing
413 journal contents show internal header
414 information of the journal fields
415 accessed.</para></listitem>
419 <term><option>--disk-usage</option></term>
421 <listitem><para>Shows the current disk
423 journal files.</para></listitem>
427 <term><option>--list-catalog</option></term>
429 <listitem><para>List the contents of
430 the message catalog, as table of
431 message IDs plus their short
432 description strings.</para></listitem>
436 <term><option>--update-catalog</option></term>
438 <listitem><para>Update the message
439 catalog index. This command needs to
440 be executed each time new catalog
441 files are installed, removed or
442 updated to rebuild the binary catalog
443 index.</para></listitem>
447 <term><option>--setup-keys</option></term>
449 <listitem><para>Instead of showing
450 journal contents generate a new key
451 pair for Forward Secure Sealing
452 (FSS). This will generate a sealing
453 key and a verification key. The
454 sealing key is stored in the journal
455 data directory and shall remain on the
456 host. The verification key should be
457 stored externally.</para></listitem>
461 <term><option>--interval=</option></term>
463 <listitem><para>Specifies the change
464 interval for the sealing key, when
465 generating an FSS key pair with
466 <option>--setup-keys</option>. Shorter
467 intervals increase CPU consumption but
468 shorten the time range of
470 alterations. Defaults to
471 15min.</para></listitem>
475 <term><option>--verify</option></term>
477 <listitem><para>Check the journal file
478 for internal consistency. If the
479 file has been generated with FSS
480 enabled, and the FSS verification key
481 has been specified with
482 <option>--verify-key=</option>
483 authenticity of the journal file is
484 verified.</para></listitem>
488 <term><option>--verify-key=</option></term>
490 <listitem><para>Specifies the FSS
491 verification key to use for the
492 <option>--verify</option>
493 operation.</para></listitem>
500 <title>Exit status</title>
502 <para>On success 0 is returned, a non-zero failure
503 code otherwise.</para>
507 <title>Environment</title>
511 <term><varname>$SYSTEMD_PAGER</varname></term>
512 <listitem><para>Pager to use when
513 <option>--no-pager</option> is not given;
514 overrides <varname>$PAGER</varname>. Setting
515 this to an empty string or the value
516 <literal>cat</literal> is equivalent to passing
517 <option>--no-pager</option>.</para></listitem>
523 <title>Examples</title>
525 <para>Without arguments all collected logs are shown
528 <programlisting>journalctl</programlisting>
530 <para>With one match specified all entries with a field matching the expression are shown:</para>
532 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service</programlisting>
534 <para>If two different fields are matched only entries matching both expressions at the same time are shown:</para>
536 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
538 <para>If two matches refer to the same field all entries matching either expression are shown:</para>
540 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
542 <para>If the separator "<literal>+</literal>" is used
543 two expressions may be combined in a logical OR. The
544 following will show all messages from the Avahi
545 service process with the PID 28097 plus all messages
546 from the D-Bus service (from any of its
549 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
551 <para>Show all logs generated by the D-Bus executable:</para>
553 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
555 <para>Show all logs of the kernel device node <filename>/dev/sda</filename>:</para>
557 <programlisting>journalctl /dev/sda</programlisting>
562 <title>See Also</title>
564 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
565 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
566 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
567 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
568 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>