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 the following options:
241 <option>short</option>
245 and generates an output
246 that is mostly identical
248 classic syslog files,
250 journal entry.</para>
256 <option>short-iso</option>
259 <para>is very similar,
261 wallclock timestamps.
268 <option>short-precise</option>
271 <para>is very similar,
273 with full microsecond
281 <option>short-monotonic</option>
284 <para>is very similar
286 timestamps instead of
287 wallclock timestamps.
294 <option>verbose</option>
298 full-structured entry
299 items with all fields.
306 <option>export</option>
310 journal into a binary
311 (but mostly text-based)
315 url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
316 Export Format</ulink>
324 <option>json</option>
327 <para>formats entries
328 as JSON data structures,
329 one per line (see <ulink
330 url="http://www.freedesktop.org/wiki/Software/systemd/json">Journal
331 JSON Format</ulink> for
332 more information).</para>
338 <option>json-pretty</option>
341 <para>formats entries as
342 JSON data structures,
344 multiple lines in order
346 readable for humans.</para>
352 <option>json-sse</option>
355 <para>formats entries as
356 JSON data structures,
358 format suitable for <ulink
359 url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events">Server-Sent
360 Events</ulink>.</para>
369 <para>generates a very
372 message of each journal
373 entry with no meta data,
374 not even a timestamp.
383 <term><option>-x</option></term>
384 <term><option>--catalog</option></term>
386 <listitem><para>Augment log lines with
387 explanation texts from the message
388 catalog. This will add explanatory
389 help texts to log messages in the
390 output where this is available. These
391 short help texts will explain the
392 context of an error or log event,
393 possible solutions, as well as
394 pointers to support forums, developer
395 documentation and any other relevant
396 manuals. Note that help texts are not
397 available for all messages, but only
398 for selected ones. For more
399 information on the message catalog,
400 please refer to the <ulink
401 url="http://www.freedesktop.org/wiki/Software/systemd/catalog">Message
403 Documentation</ulink>.</para></listitem>
407 <term><option>-q</option></term>
408 <term><option>--quiet</option></term>
410 <listitem><para>Suppresses any warning
411 message regarding inaccessible system
412 journals when run as normal
413 user.</para></listitem>
417 <term><option>-m</option></term>
418 <term><option>--merge</option></term>
420 <listitem><para>Show entries
421 interleaved from all available
422 journals, including remote
423 ones.</para></listitem>
427 <term><option>-b <optional><replaceable>ID</replaceable></optional><optional><replaceable>±offset</replaceable></optional></option></term>
428 <term><option>--boot=<optional><replaceable>ID</replaceable></optional><optional><replaceable>±offset</replaceable></optional></option></term>
430 <listitem><para>Show messages from a specific
431 boot. This will add a match for
432 <literal>_BOOT_ID=</literal>.</para>
434 <para>The argument may be empty, in which case
435 logs for the current boot will be shown.</para>
437 <para>If the boot ID is omitted, a positive
438 <replaceable>offset</replaceable> will look up
439 the boots starting from the beginning of the
440 journal, and a equal-or-less-than zero
441 <replaceable>offset</replaceable> will look up
442 boots starting from the end of the
443 journal. Thus, <constant>1</constant> means the
444 first boot found in the journal in the
445 chronological order, <constant>2</constant> the
446 second and so on; while <constant>-0</constant>
447 is the last boot, <constant>-1</constant> the
448 boot before that, and so on. An empty
449 <replaceable>offset</replaceable> is equivalent
450 to specifying <constant>-0</constant>, except
451 when the current boot is not the last boot
452 (e.g. because <option>--directory</option> was
453 specified to look at logs from a different
456 <para>If the 32 character
457 <replaceable>ID</replaceable> is specified, it
458 may optionally be followed by
459 <replaceable>offset</replaceable> which
460 identifies the boot relative to the one given by
461 boot <replaceable>ID</replaceable>. Negative
462 values mean earlier boots and a positive values
464 <replaceable>offset</replaceable> is not
465 specified, a value of zero is assumed and the
466 logs for the boot given by
467 <replaceable>ID</replaceable> are shown.
474 <term><option>-k</option></term>
475 <term><option>--dmesg</option></term>
477 <listitem><para>Show only kernel messages. This
478 implies <option>-b</option> and adds the match
479 <literal>_TRANSPORT=kernel</literal>.
484 <term><option>-u</option></term>
485 <term><option>--unit=</option></term>
487 <listitem><para>Show messages for the
488 specified systemd unit. This will add
489 a match for messages from the unit
490 (<literal>_SYSTEMD_UNIT=</literal>)
491 and additional matches for messages
492 from systemd and messages about
493 coredumps for the specified unit.</para>
494 <para>This parameter can be specified multiple times.
499 <term><option>--user-unit=</option></term>
501 <listitem><para>Show messages for the
502 specified user session unit. This will
503 add a match for messages from the unit
504 (<literal>_SYSTEMD_USER_UNIT=</literal>
505 and <literal>_UID=</literal>) and
506 additional matches for messages from
507 session systemd and messages about
508 coredumps for the specified unit.</para>
509 <para>This parameter can be specified multiple times.
514 <term><option>-p</option></term>
515 <term><option>--priority=</option></term>
517 <listitem><para>Filter output by
518 message priorities or priority
519 ranges. Takes either a single numeric
520 or textual log level (i.e. between
521 0/<literal>emerg</literal> and
522 7/<literal>debug</literal>), or a
523 range of numeric/text log levels in
524 the form FROM..TO. The log levels are
525 the usual syslog log levels as
527 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
528 i.e. <literal>emerg</literal> (0),
529 <literal>alert</literal> (1),
530 <literal>crit</literal> (2),
531 <literal>err</literal> (3),
532 <literal>warning</literal> (4),
533 <literal>notice</literal> (5),
534 <literal>info</literal> (6),
535 <literal>debug</literal> (7). If a
536 single log level is specified, all
537 messages with this log level or a
538 lower (hence more important) log level
539 are shown. If a range is specified, all
540 messages within the range are shown,
541 including both the start and the end
542 value of the range. This will add
543 <literal>PRIORITY=</literal> matches
545 priorities.</para></listitem>
549 <term><option>-c</option></term>
550 <term><option>--cursor=</option></term>
552 <listitem><para>Start showing entries
553 from the location in the journal
554 specified by the passed
555 cursor.</para></listitem>
559 <term><option>--after-cursor=</option></term>
561 <listitem><para>Start showing entries from the
562 location in the journal
563 <emphasis>after</emphasis> the location
564 specified by the this cursor.
569 <term><option>--since=</option></term>
570 <term><option>--until=</option></term>
572 <listitem><para>Start showing entries
573 on or newer than the specified date,
574 or on or older than the specified
575 date, respectively. Date specifications
576 should be of the format
577 <literal>2012-10-30 18:17:16</literal>.
578 If the time part is omitted,
579 <literal>00:00:00</literal> is assumed.
580 If only the seconds component is omitted,
581 <literal>:00</literal> is assumed. If the
582 date component is omitted, the current
583 day is assumed. Alternatively the strings
584 <literal>yesterday</literal>,
585 <literal>today</literal>,
586 <literal>tomorrow</literal> are
587 understood, which refer to 00:00:00 of
588 the day before the current day, the
589 current day, or the day after the
590 current day, respectively. <literal>now</literal>
591 refers to the current time. Finally,
592 relative times may be specified,
593 prefixed with <literal>-</literal> or
594 <literal>+</literal>, referring to
595 times before or after the current
596 time, respectively.</para></listitem>
600 <term><option>-F</option></term>
601 <term><option>--field=</option></term>
603 <listitem><para>Print all possible
604 data values the specified field can
605 take in all entries of the
606 journal.</para></listitem>
610 <term><option>--system</option></term>
611 <term><option>--user</option></term>
613 <listitem><para>Show messages from
614 system services and the kernel (with
615 <option>--system</option>). Show
616 messages from service of current user
617 (with <option>--user</option>).
618 If neither is specified, show all
619 messages that the user can see.
624 <term><option>-D <replaceable>DIR</replaceable></option></term>
625 <term><option>--directory=<replaceable>DIR</replaceable></option></term>
627 <listitem><para>Takes a directory path
628 as argument. If specified, journalctl
629 will operate on the specified journal
631 <replaceable>DIR</replaceable> instead
632 of the default runtime and system
633 journal paths.</para></listitem>
637 <term><option>--file=<replaceable>GLOB</replaceable></option></term>
639 <listitem><para>Takes a file glob as
640 argument. If specified, journalctl will
641 operate on the specified journal files
642 matching <replaceable>GLOB</replaceable>
643 instead of the default runtime and
644 system journal paths. May be specified
645 multiple times, in which case files will
646 be suitably interleaved.</para></listitem>
650 <term><option>--root=<replaceable>ROOT</replaceable></option></term>
652 <listitem><para>Takes a directory path
653 as argument. If specified, journalctl
654 will operate on catalog file hierarchy
655 underneath the specified directory
656 instead of the root directory
657 (e.g. <option>--update-catalog</option>
659 <filename><replaceable>ROOT</replaceable>/var/lib/systemd/catalog/database</filename>).
664 <term><option>--new-id128</option></term>
666 <listitem><para>Instead of showing
667 journal contents, generate a new 128
668 bit ID suitable for identifying
669 messages. This is intended for usage
670 by developers who need a new
671 identifier for a new message they
672 introduce and want to make
673 recognizable. This will print the new ID in
674 three different formats which can be
675 copied into source code or
676 similar.</para></listitem>
680 <term><option>--header</option></term>
682 <listitem><para>Instead of showing
683 journal contents, show internal header
684 information of the journal fields
685 accessed.</para></listitem>
689 <term><option>--disk-usage</option></term>
691 <listitem><para>Shows the current disk
693 journal files.</para></listitem>
697 <term><option>--list-catalog
698 <optional><replaceable>ID128...</replaceable></optional>
701 <listitem><para>List the contents of
702 the message catalog, as table of
703 message IDs plus their short
704 description strings.</para>
707 <replaceable>ID128</replaceable>s are
708 specified, only those entries are shown.
714 <term><option>--dump-catalog
715 <optional><replaceable>ID128...</replaceable></optional>
718 <listitem><para>Show the contents of
719 the message catalog, with entries
720 separated by a line consisting of two
721 dashes and the id (the format is the
722 same as <filename>.catalog</filename>
726 <replaceable>ID128</replaceable>s are
727 specified, only those entries are shown.
733 <term><option>--update-catalog</option></term>
735 <listitem><para>Update the message
736 catalog index. This command needs to
737 be executed each time new catalog
738 files are installed, removed or
739 updated to rebuild the binary catalog
740 index.</para></listitem>
744 <term><option>--setup-keys</option></term>
746 <listitem><para>Instead of showing
747 journal contents, generate a new key
748 pair for Forward Secure Sealing
749 (FSS). This will generate a sealing
750 key and a verification key. The
751 sealing key is stored in the journal
752 data directory and shall remain on the
753 host. The verification key should be
754 stored externally. Also see the
755 <option>Seal=</option> option in
756 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
757 for details.</para></listitem>
761 <term><option>--force</option></term>
763 <listitem><para>When --setup-keys is passed and
764 Forward Secure Sealing has already been set up,
765 recreate FSS keys.</para></listitem>
769 <term><option>--interval=</option></term>
771 <listitem><para>Specifies the change
772 interval for the sealing key when
773 generating an FSS key pair with
774 <option>--setup-keys</option>. Shorter
775 intervals increase CPU consumption but
776 shorten the time range of
778 alterations. Defaults to
779 15min.</para></listitem>
783 <term><option>--verify</option></term>
785 <listitem><para>Check the journal file
786 for internal consistency. If the
787 file has been generated with FSS
788 enabled and the FSS verification key
789 has been specified with
790 <option>--verify-key=</option>,
791 authenticity of the journal file is
792 verified.</para></listitem>
796 <term><option>--verify-key=</option></term>
798 <listitem><para>Specifies the FSS
799 verification key to use for the
800 <option>--verify</option>
801 operation.</para></listitem>
808 <title>Exit status</title>
810 <para>On success, 0 is returned, a non-zero failure
811 code otherwise.</para>
815 <title>Environment</title>
817 <variablelist class='environment-variables'>
819 <term><varname>$SYSTEMD_PAGER</varname></term>
820 <listitem><para>Pager to use when
821 <option>--no-pager</option> is not given;
822 overrides <varname>$PAGER</varname>. Setting
823 this to an empty string or the value
824 <literal>cat</literal> is equivalent to passing
825 <option>--no-pager</option>.</para></listitem>
831 <title>Examples</title>
833 <para>Without arguments, all collected logs are shown
836 <programlisting>journalctl</programlisting>
838 <para>With one match specified, all entries with a field matching the expression are shown:</para>
840 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service</programlisting>
842 <para>If two different fields are matched, only entries matching both expressions at the same time are shown:</para>
844 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
846 <para>If two matches refer to the same field, all entries matching either expression are shown:</para>
848 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
850 <para>If the separator <literal>+</literal> is used,
851 two expressions may be combined in a logical OR. The
852 following will show all messages from the Avahi
853 service process with the PID 28097 plus all messages
854 from the D-Bus service (from any of its
857 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
859 <para>Show all logs generated by the D-Bus executable:</para>
861 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
863 <para>Show all logs of the kernel device node <filename noindex='true'>/dev/sda</filename>:</para>
865 <programlisting>journalctl /dev/sda</programlisting>
867 <para>Show all kernel logs from previous boot:</para>
869 <programlisting>journalctl -k -b -1</programlisting>
874 <title>See Also</title>
876 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
877 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
878 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
879 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
880 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>