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</command>
53 <arg choice="opt" rep="repeat">OPTIONS</arg>
54 <arg choice="opt" rep="repeat">MATCHES</arg>
59 <title>Description</title>
61 <para><command>journalctl</command> may be used to
62 query the contents of the
63 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
65 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
67 <para>If called without parameters, it will show the full
68 contents of the journal, starting with the oldest
69 entry collected.</para>
71 <para>If one or more match arguments are passed, the
72 output is filtered accordingly. A match is in the
73 format <literal>FIELD=VALUE</literal>,
74 e.g. <literal>_SYSTEMD_UNIT=httpd.service</literal>,
75 referring to the components of a structured journal
77 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
78 for a list of well-known fields. If multiple matches
79 are specified matching different fields, the log
80 entries are filtered by both, i.e. the resulting output
81 will show only entries matching all the specified
82 matches of this kind. If two matches apply to the same
83 field, then they are automatically matched as
84 alternatives, i.e. the resulting output will show
85 entries matching any of the specified matches for the
86 same field. Finally, if the character
87 <literal>+</literal> appears as separate word on the
88 command line, all matches before and after are combined
89 in a disjunction (i.e. logical OR).</para>
91 <para>As shortcuts for a few types of field/value
92 matches, file paths may be specified. If a file path
93 refers to an executable file, this is equivalent to an
94 <literal>_EXE=</literal> match for the canonicalized
95 binary path. Similarly, if a path refers to a device
96 node, this is equivalent to a
97 <literal>_KERNEL_DEVICE=</literal> match for the
100 <para>Output is interleaved from all accessible
101 journal files, whether they are rotated or currently
102 being written, and regardless of whether they belong to the
103 system itself or are accessible user journals.</para>
105 <para>All users are granted access to their private
106 per-user journals. However, by default, only root and
107 users who are members of the <literal>adm</literal>
108 group get access to the system journal and the
109 journals of other users.</para>
111 <para>The output is paged through
112 <command>less</command> by default, and long lines are
113 "truncated" to screen width. The hidden part can be
114 viewed by using the left-arrow and right-arrow
115 keys. Paging can be disabled, see
116 <option>--no-pager</option> and section Environment
119 <para>When outputing to a tty, lines are colored
120 according to priority: lines of level ERROR and higher
121 are colored red, lines of level NOTICE and higher are
122 highlighted, and other lines are displayed normally.
127 <title>Options</title>
129 <para>The following options are understood:</para>
133 <term><option>-h</option></term>
134 <term><option>--help</option></term>
136 <listitem><para>Prints a short help
137 text and exits.</para></listitem>
141 <term><option>--version</option></term>
143 <listitem><para>Prints a short version
144 string and exits.</para></listitem>
148 <term><option>--no-pager</option></term>
150 <listitem><para>Do not pipe output into a
151 pager.</para></listitem>
155 <term><option>-l</option></term>
156 <term><option>--full</option></term>
158 <listitem><para>Show all (printable) fields in
159 full.</para></listitem>
163 <term><option>-a</option></term>
164 <term><option>--all</option></term>
166 <listitem><para>Show all fields in
167 full, even if they include unprintable
168 characters or are very
169 long.</para></listitem>
173 <term><option>-f</option></term>
174 <term><option>--follow</option></term>
176 <listitem><para>Show only the most recent
177 journal entries, and continuously print
178 new entries as they are appended to
179 the journal.</para></listitem>
183 <term><option>-e</option></term>
184 <term><option>--pager-end</option></term>
186 <listitem><para>Immediately jump to
187 the end of the journal inside the
188 implied pager tool. This implies
189 <option>-n1000</option> to guarantee
190 that the pager will not buffer logs of
191 unbounded size. This may be overridden
192 with an explicit <option>-n</option>
193 with some other numeric value on the
194 command line. Note that this option is
195 only supported for the
196 <citerefentry><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>
197 pager.</para></listitem>
201 <term><option>-n</option></term>
202 <term><option>--lines=</option></term>
204 <listitem><para>Show the most recent
205 journal events and limit the number of
207 <option>--follow</option> is used,
208 this option is implied. The argument,
209 a positive integer, is optional, and
210 defaults to 10. </para></listitem>
214 <term><option>--no-tail</option></term>
216 <listitem><para>Show all stored output
217 lines, even in follow mode. Undoes the
219 <option>--lines=</option>.</para></listitem>
223 <term><option>-r</option></term>
224 <term><option>--reverse</option></term>
226 <listitem><para>Reverse output, so the newest
227 entries are displayed first.</para></listitem>
231 <term><option>-o</option></term>
232 <term><option>--output=</option></term>
234 <listitem><para>Controls the
235 formatting of the journal entries that
236 are shown. Takes one of
237 <literal>short</literal>,
238 <literal>short-monotonic</literal>,
239 <literal>verbose</literal>,
240 <literal>export</literal>,
241 <literal>json</literal>,
242 <literal>json-pretty</literal>,
243 <literal>json-sse</literal>,
244 <literal>cat</literal>. <literal>short</literal>
245 is the default and generates an output
246 that is mostly identical to the
247 formatting of classic syslog
248 files, showing one line per journal
249 entry. <literal>short-monotonic</literal>
250 is very similar but shows monotonic
251 timestamps instead of wallclock
252 timestamps. <literal>verbose</literal>
253 shows the full structured entry items
255 fields. <literal>export</literal>
256 serializes the journal into a binary
257 (but mostly text-based) stream
258 suitable for backups and network
260 url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
261 Export Format</ulink> for more
262 information). <literal>json</literal>
263 formats entries as JSON data
266 url="http://www.freedesktop.org/wiki/Software/systemd/json">Journal
267 JSON Format</ulink> for more
268 information). <literal>json-pretty</literal>
269 also formats entries as JSON data
270 structures, but formats them in
271 multiple lines in order to make them
273 humans. <literal>json-sse</literal>
274 also formats entries as JSON data
275 structures, but wraps them in a format
277 url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events">Server-Sent
278 Events</ulink>. <literal>cat</literal>
279 generates a very terse output only
280 showing the actual message of each
281 journal entry with no meta data, not
282 even a timestamp.</para></listitem>
286 <term><option>-x</option></term>
287 <term><option>--catalog</option></term>
289 <listitem><para>Augment log lines with
290 explanation texts from the message
291 catalog. This will add explanatory
292 help texts to log messages in the
293 output where this is available. These
294 short help texts will explain the
295 context of an error or log event,
296 possible solutions, as well as
297 pointers to support forums, developer
298 documentation and any other relevant
299 manuals. Note that help texts are not
300 available for all messages, but only
301 for selected ones. For more
302 information on the message catalog,
303 please refer to the <ulink
304 url="http://www.freedesktop.org/wiki/Software/systemd/catalog">Message
306 Documentation</ulink>.</para></listitem>
310 <term><option>-q</option></term>
311 <term><option>--quiet</option></term>
313 <listitem><para>Suppresses any warning
314 message regarding inaccessible system
315 journals when run as normal
316 user.</para></listitem>
320 <term><option>-m</option></term>
321 <term><option>--merge</option></term>
323 <listitem><para>Show entries
324 interleaved from all available
325 journals, including remote
326 ones.</para></listitem>
330 <term><option>-b <optional><replaceable>ID</replaceable></optional></option></term>
331 <term><option>--boot=<optional><replaceable>ID</replaceable></optional></option></term>
333 <listitem><para>Show messages from the specified
334 boot <replaceable>ID</replaceable> or from
335 current boot if no <replaceable>ID</replaceable>
336 is given. This will add a match for
337 <literal>_BOOT_ID=</literal>.</para>
339 <para>The argument is a 128 bit ID given in
340 short or UUID form and optionally followed by
341 <literal>:n</literal> which identifies the nth
342 boot relative to the boot ID given to the left
343 of <literal>:</literal>. Supplying a negative
344 value for n will look for a past boot and a
345 positive value for a future boot. The boot IDs
346 are searched for in chronological order. If no
347 number is provided after <literal>:</literal>,
348 <literal>-1</literal> is assumed. A value of 0
349 is valid and equivalent to omitting
350 <literal>:0</literal>.</para>
352 <para>Alternatively, the argument may constist
353 only of <literal>:n</literal>. In this case, a
354 positive value will look up the nth boot
355 starting from the beginning of the jouranl, a
356 negative value will look up a previous boot
357 relative to the current boot. <literal>:0</literal>
358 will look for the current boot ID. Thus,
359 <literal>:1</literal> is the first boot found in
360 the journal, <literal>:2</literal> the second
361 and so on; while <literal>:-1</literal> is the
362 previous boot, <literal>:-2</literal> the boot
363 before that and so on. Omitting a value after
364 <literal>:</literal> will look for the previous
365 boot.</para></listitem>
369 <term><option>-k</option></term>
370 <term><option>--dmesg</option></term>
372 <listitem><para>Show only kernel messages. This
373 implies <option>-b</option> and adds the match
374 <literal>_TRANSPORT=kernel</literal>.
379 <term><option>-u</option></term>
380 <term><option>--unit=</option></term>
382 <listitem><para>Show messages for the
383 specified systemd unit. This will add
384 a match for messages from the unit
385 (<literal>_SYSTEMD_UNIT=</literal>)
386 and additional matches for messages
387 from systemd and messages about
388 coredumps for the specified unit.</para>
389 <para>This parameter can be specified multiple times.
394 <term><option>--user-unit=</option></term>
396 <listitem><para>Show messages for the
397 specified user session unit. This will
398 add a match for messages from the unit
399 (<literal>_SYSTEMD_USER_UNIT=</literal>
400 and <literal>_UID=</literal>) and
401 additional matches for messages from
402 session systemd and messages about
403 coredumps for the specified unit.</para>
404 <para>This parameter can be specified multiple times.
409 <term><option>-p</option></term>
410 <term><option>--priority=</option></term>
412 <listitem><para>Filter output by
413 message priorities or priority
414 ranges. Takes either a single numeric
415 or textual log level (i.e. between
416 0/<literal>emerg</literal> and
417 7/<literal>debug</literal>), or a
418 range of numeric/text log levels in
419 the form FROM..TO. The log levels are
420 the usual syslog log levels as
422 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
423 i.e. <literal>emerg</literal> (0),
424 <literal>alert</literal> (1),
425 <literal>crit</literal> (2),
426 <literal>err</literal> (3),
427 <literal>warning</literal> (4),
428 <literal>notice</literal> (5),
429 <literal>info</literal> (6),
430 <literal>debug</literal> (7). If a
431 single log level is specified, all
432 messages with this log level or a
433 lower (hence more important) log level
434 are shown. If a range is specified, all
435 messages within the range are shown,
436 including both the start and the end
437 value of the range. This will add
438 <literal>PRIORITY=</literal> matches
440 priorities.</para></listitem>
444 <term><option>-c</option></term>
445 <term><option>--cursor=</option></term>
447 <listitem><para>Start showing entries
448 from the location in the journal
449 specified by the passed
450 cursor.</para></listitem>
454 <term><option>--since=</option></term>
455 <term><option>--until=</option></term>
457 <listitem><para>Start showing entries
458 on or newer than the specified date,
459 or on or older than the specified
460 date, respectively. Date specifications
461 should be of the format
462 <literal>2012-10-30 18:17:16</literal>.
463 If the time part is omitted,
464 <literal>00:00:00</literal> is assumed.
465 If only the seconds component is omitted,
466 <literal>:00</literal> is assumed. If the
467 date component is omitted, the current
468 day is assumed. Alternatively the strings
469 <literal>yesterday</literal>,
470 <literal>today</literal>,
471 <literal>tomorrow</literal> are
472 understood, which refer to 00:00:00 of
473 the day before the current day, the
474 current day, or the day after the
475 current day, respectively. <literal>now</literal>
476 refers to the current time. Finally,
477 relative times may be specified,
478 prefixed with <literal>-</literal> or
479 <literal>+</literal>, referring to
480 times before or after the current
481 time, respectively.</para></listitem>
485 <term><option>-F</option></term>
486 <term><option>--field=</option></term>
488 <listitem><para>Print all possible
489 data values the specified field can
490 take in all entries of the
491 journal.</para></listitem>
495 <term><option>--system</option></term>
496 <term><option>--user</option></term>
498 <listitem><para>Show messages from
499 system services and the kernel (with
500 <option>--system</option>). Show
501 messages from service of current user
502 (with <option>--user</option>).
503 If neither is specified, show all
504 messages that the user can see.
509 <term><option>-D <replaceable>DIR</replaceable></option></term>
510 <term><option>--directory=<replaceable>DIR</replaceable></option></term>
512 <listitem><para>Takes a directory path
513 as argument. If specified, journalctl
514 will operate on the specified journal
516 <replaceable>DIR</replaceable> instead
517 of the default runtime and system
518 journal paths.</para></listitem>
522 <term><option>--file=<replaceable>GLOB</replaceable></option></term>
524 <listitem><para>Takes a file glob as
525 argument. If specified, journalctl will
526 operate on the specified journal files
527 matching <replaceable>GLOB</replaceable>
528 instead of the default runtime and
529 system journal paths. May be specified
530 multiple times, in which case files will
531 be suitably interleaved.</para></listitem>
535 <term><option>--root=<replaceable>ROOT</replaceable></option></term>
537 <listitem><para>Takes a directory path
538 as argument. If specified, journalctl
539 will operate on catalog file hierarchy
540 underneath the specified directory
541 instead of the root directory
542 (e.g. <option>--update-catalog</option>
544 <filename><replaceable>ROOT</replaceable>/var/lib/systemd/catalog/database</filename>).
549 <term><option>--new-id128</option></term>
551 <listitem><para>Instead of showing
552 journal contents, generate a new 128
553 bit ID suitable for identifying
554 messages. This is intended for usage
555 by developers who need a new
556 identifier for a new message they
557 introduce and want to make
558 recognizable. This will print the new ID in
559 three different formats which can be
560 copied into source code or
561 similar.</para></listitem>
565 <term><option>--header</option></term>
567 <listitem><para>Instead of showing
568 journal contents, show internal header
569 information of the journal fields
570 accessed.</para></listitem>
574 <term><option>--disk-usage</option></term>
576 <listitem><para>Shows the current disk
578 journal files.</para></listitem>
582 <term><option>--list-catalog
583 <optional><replaceable>ID128...</replaceable></optional>
586 <listitem><para>List the contents of
587 the message catalog, as table of
588 message IDs plus their short
589 description strings.</para>
592 <replaceable>ID128</replaceable>s are
593 specified, only those entries are shown.
599 <term><option>--dump-catalog
600 <optional><replaceable>ID128...</replaceable></optional>
603 <listitem><para>Show the contents of
604 the message catalog, with entries
605 separated by a line consisting of two
606 dashes and the id (the format is the
607 same as <filename>.catalog</filename>
611 <replaceable>ID128</replaceable>s are
612 specified, only those entries are shown.
618 <term><option>--update-catalog</option></term>
620 <listitem><para>Update the message
621 catalog index. This command needs to
622 be executed each time new catalog
623 files are installed, removed or
624 updated to rebuild the binary catalog
625 index.</para></listitem>
629 <term><option>--setup-keys</option></term>
631 <listitem><para>Instead of showing
632 journal contents, generate a new key
633 pair for Forward Secure Sealing
634 (FSS). This will generate a sealing
635 key and a verification key. The
636 sealing key is stored in the journal
637 data directory and shall remain on the
638 host. The verification key should be
639 stored externally. Also see the
640 <option>Seal=</option> option in
641 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
642 for details.</para></listitem>
646 <term><option>--force</option></term>
648 <listitem><para>When --setup-keys is passed and
649 Forward Secure Sealing has already been set up,
650 recreate FSS keys.</para></listitem>
654 <term><option>--interval=</option></term>
656 <listitem><para>Specifies the change
657 interval for the sealing key when
658 generating an FSS key pair with
659 <option>--setup-keys</option>. Shorter
660 intervals increase CPU consumption but
661 shorten the time range of
663 alterations. Defaults to
664 15min.</para></listitem>
668 <term><option>--verify</option></term>
670 <listitem><para>Check the journal file
671 for internal consistency. If the
672 file has been generated with FSS
673 enabled and the FSS verification key
674 has been specified with
675 <option>--verify-key=</option>,
676 authenticity of the journal file is
677 verified.</para></listitem>
681 <term><option>--verify-key=</option></term>
683 <listitem><para>Specifies the FSS
684 verification key to use for the
685 <option>--verify</option>
686 operation.</para></listitem>
693 <title>Exit status</title>
695 <para>On success, 0 is returned, a non-zero failure
696 code otherwise.</para>
700 <title>Environment</title>
702 <variablelist class='environment-variables'>
704 <term><varname>$SYSTEMD_PAGER</varname></term>
705 <listitem><para>Pager to use when
706 <option>--no-pager</option> is not given;
707 overrides <varname>$PAGER</varname>. Setting
708 this to an empty string or the value
709 <literal>cat</literal> is equivalent to passing
710 <option>--no-pager</option>.</para></listitem>
716 <title>Examples</title>
718 <para>Without arguments, all collected logs are shown
721 <programlisting>journalctl</programlisting>
723 <para>With one match specified, all entries with a field matching the expression are shown:</para>
725 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service</programlisting>
727 <para>If two different fields are matched, only entries matching both expressions at the same time are shown:</para>
729 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
731 <para>If two matches refer to the same field, all entries matching either expression are shown:</para>
733 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
735 <para>If the separator <literal>+</literal> is used,
736 two expressions may be combined in a logical OR. The
737 following will show all messages from the Avahi
738 service process with the PID 28097 plus all messages
739 from the D-Bus service (from any of its
742 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
744 <para>Show all logs generated by the D-Bus executable:</para>
746 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
748 <para>Show all logs of the kernel device node <filename noindex='true'>/dev/sda</filename>:</para>
750 <programlisting>journalctl /dev/sda</programlisting>
752 <para>Show all kernel logs from last boot:</para>
754 <programlisting>journalctl -k -b :</programlisting>
759 <title>See Also</title>
761 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
762 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
763 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
764 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
765 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>