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"
25 xmlns:xi="http://www.w3.org/2001/XInclude">
28 <title>journalctl</title>
29 <productname>systemd</productname>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
42 <refentrytitle>journalctl</refentrytitle>
43 <manvolnum>1</manvolnum>
47 <refname>journalctl</refname>
48 <refpurpose>Query the systemd journal</refpurpose>
53 <command>journalctl</command>
54 <arg choice="opt" rep="repeat">OPTIONS</arg>
55 <arg choice="opt" rep="repeat">MATCHES</arg>
60 <title>Description</title>
62 <para><command>journalctl</command> may be used to
63 query the contents of the
64 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
66 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
68 <para>If called without parameters, it will show the full
69 contents of the journal, starting with the oldest
70 entry collected.</para>
72 <para>If one or more match arguments are passed, the
73 output is filtered accordingly. A match is in the
74 format <literal>FIELD=VALUE</literal>,
75 e.g. <literal>_SYSTEMD_UNIT=httpd.service</literal>,
76 referring to the components of a structured journal
78 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
79 for a list of well-known fields. If multiple matches
80 are specified matching different fields, the log
81 entries are filtered by both, i.e. the resulting output
82 will show only entries matching all the specified
83 matches of this kind. If two matches apply to the same
84 field, then they are automatically matched as
85 alternatives, i.e. the resulting output will show
86 entries matching any of the specified matches for the
87 same field. Finally, if the character
88 <literal>+</literal> appears as a separate word on the
89 command line, all matches before and after are combined
90 in a disjunction (i.e. logical OR).</para>
92 <para>As shortcuts for a few types of field/value
93 matches, file paths may be specified. If a file path
94 refers to an executable file, this is equivalent to an
95 <literal>_EXE=</literal> match for the canonicalized
96 binary path. Similarly, if a path refers to a device
97 node, this is equivalent to a
98 <literal>_KERNEL_DEVICE=</literal> match for the
101 <para>Output is interleaved from all accessible
102 journal files, whether they are rotated or currently
103 being written, and regardless of whether they belong to the
104 system itself or are accessible user journals.</para>
106 <para>All users are granted access to their private
107 per-user journals. However, by default, only root and
108 users who are members of the <literal>systemd-journal</literal>
109 group get access to the system journal and the
110 journals of other users.</para>
112 <para>The output is paged through
113 <command>less</command> by default, and long lines are
114 "truncated" to screen width. The hidden part can be
115 viewed by using the left-arrow and right-arrow
116 keys. Paging can be disabled; see the
117 <option>--no-pager</option> option and the "Environment"
118 section below.</para>
120 <para>When outputing to a tty, lines are colored
121 according to priority: lines of level ERROR and higher
122 are colored red; lines of level NOTICE and higher are
123 highlighted; other lines are displayed normally.
128 <title>Options</title>
130 <para>The following options are understood:</para>
134 <term><option>--no-full</option></term>
135 <term><option>--full</option></term>
136 <term><option>-l</option></term>
138 <listitem><para>Ellipsize fields when
139 they do not fit in available columns.
140 The default is to show full fields,
141 allowing them to wrap or be truncated
142 by the pager, if one is used.</para>
144 <para>The old options
145 <option>-l</option>/<option>--full</option>
146 are not useful anymore, except to undo
147 <option>--no-full</option>.</para></listitem>
151 <term><option>-a</option></term>
152 <term><option>--all</option></term>
154 <listitem><para>Show all fields in
155 full, even if they include unprintable
156 characters or are very
157 long.</para></listitem>
161 <term><option>-f</option></term>
162 <term><option>--follow</option></term>
164 <listitem><para>Show only the most recent
165 journal entries, and continuously print
166 new entries as they are appended to
167 the journal.</para></listitem>
171 <term><option>-e</option></term>
172 <term><option>--pager-end</option></term>
174 <listitem><para>Immediately jump to
175 the end of the journal inside the
176 implied pager tool. This implies
177 <option>-n1000</option> to guarantee
178 that the pager will not buffer logs of
179 unbounded size. This may be overridden
180 with an explicit <option>-n</option>
181 with some other numeric value on the
182 command line. Note that this option is
183 only supported for the
184 <citerefentry project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>
185 pager.</para></listitem>
189 <term><option>-n</option></term>
190 <term><option>--lines=</option></term>
192 <listitem><para>Show the most recent
193 journal events and limit the number of
195 <option>--follow</option> is used,
196 this option is implied. The argument,
197 a positive integer, is optional, and
198 defaults to 10. </para></listitem>
202 <term><option>--no-tail</option></term>
204 <listitem><para>Show all stored output
205 lines, even in follow mode. Undoes the
207 <option>--lines=</option>.</para></listitem>
211 <term><option>-r</option></term>
212 <term><option>--reverse</option></term>
214 <listitem><para>Reverse output so that the newest
215 entries are displayed first.</para></listitem>
219 <term><option>-o</option></term>
220 <term><option>--output=</option></term>
222 <listitem><para>Controls the
223 formatting of the journal entries that
224 are shown. Takes one of the following options:
229 <option>short</option>
233 and generates an output
234 that is mostly identical
236 classic syslog files,
238 journal entry.</para>
244 <option>short-iso</option>
247 <para>is very similar,
249 wallclock timestamps.
256 <option>short-precise</option>
259 <para>is very similar,
261 with full microsecond
269 <option>short-monotonic</option>
272 <para>is very similar,
274 timestamps instead of
275 wallclock timestamps.
282 <option>verbose</option>
286 full-structured entry
287 items with all fields.
294 <option>export</option>
298 journal into a binary
299 (but mostly text-based)
303 url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
304 Export Format</ulink>
312 <option>json</option>
315 <para>formats entries
316 as JSON data structures,
317 one per line (see <ulink
318 url="http://www.freedesktop.org/wiki/Software/systemd/json">Journal
319 JSON Format</ulink> for
320 more information).</para>
326 <option>json-pretty</option>
329 <para>formats entries as
330 JSON data structures,
332 multiple lines in order
334 readable by humans.</para>
340 <option>json-sse</option>
343 <para>formats entries as
344 JSON data structures,
346 format suitable for <ulink
347 url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events">Server-Sent
348 Events</ulink>.</para>
357 <para>generates a very
360 message of each journal
361 entry with no metadata,
362 not even a timestamp.
371 <term><option>-x</option></term>
372 <term><option>--catalog</option></term>
374 <listitem><para>Augment log lines with
375 explanation texts from the message
376 catalog. This will add explanatory
377 help texts to log messages in the
378 output where this is available. These
379 short help texts will explain the
380 context of an error or log event,
381 possible solutions, as well as
382 pointers to support forums, developer
383 documentation, and any other relevant
384 manuals. Note that help texts are not
385 available for all messages, but only
386 for selected ones. For more
387 information on the message catalog,
388 please refer to the <ulink
389 url="http://www.freedesktop.org/wiki/Software/systemd/catalog">Message
391 Documentation</ulink>.</para>
393 <para>Note: when attaching
394 <command>journalctl</command> output
395 to bug reports, please do
396 <emphasis>not</emphasis> use
397 <option>-x</option>.</para>
402 <term><option>-q</option></term>
403 <term><option>--quiet</option></term>
405 <listitem><para>Suppresses any warning
406 messages regarding inaccessible system
407 journals when run as a normal
408 user.</para></listitem>
412 <term><option>-m</option></term>
413 <term><option>--merge</option></term>
415 <listitem><para>Show entries
416 interleaved from all available
417 journals, including remote
418 ones.</para></listitem>
422 <term><option>-b <optional><replaceable>ID</replaceable></optional><optional><replaceable>±offset</replaceable></optional></option></term>
423 <term><option>--boot=<optional><replaceable>ID</replaceable></optional><optional><replaceable>±offset</replaceable></optional></option></term>
425 <listitem><para>Show messages from a specific
426 boot. This will add a match for
427 <literal>_BOOT_ID=</literal>.</para>
429 <para>The argument may be empty, in which case
430 logs for the current boot will be shown.</para>
432 <para>If the boot ID is omitted, a positive
433 <replaceable>offset</replaceable> will look up
434 the boots starting from the beginning of the
435 journal, and a equal-or-less-than zero
436 <replaceable>offset</replaceable> will look up
437 boots starting from the end of the
438 journal. Thus, <constant>1</constant> means the
439 first boot found in the journal in
440 chronological order, <constant>2</constant> the
441 second and so on; while <constant>-0</constant>
442 is the last boot, <constant>-1</constant> the
443 boot before last, and so on. An empty
444 <replaceable>offset</replaceable> is equivalent
445 to specifying <constant>-0</constant>, except
446 when the current boot is not the last boot
447 (e.g. because <option>--directory</option> was
448 specified to look at logs from a different
451 <para>If the 32-character
452 <replaceable>ID</replaceable> is specified, it
453 may optionally be followed by
454 <replaceable>offset</replaceable> which
455 identifies the boot relative to the one given by
456 boot <replaceable>ID</replaceable>. Negative
457 values mean earlier boots and a positive values
459 <replaceable>offset</replaceable> is not
460 specified, a value of zero is assumed, and the
461 logs for the boot given by
462 <replaceable>ID</replaceable> are shown.
469 <term><option>--list-boots</option></term>
471 <listitem><para>Show a tabular list of
472 boot numbers (relative to the current
473 boot), their IDs, and the timestamps
474 of the first and last message
475 pertaining to the boot.
480 <term><option>-k</option></term>
481 <term><option>--dmesg</option></term>
483 <listitem><para>Show only kernel messages. This
484 implies <option>-b</option> and adds the match
485 <literal>_TRANSPORT=kernel</literal>.
490 <term><option>-u</option></term>
491 <term><option>--unit=<replaceable>UNIT</replaceable>|<replaceable>PATTERN</replaceable></option></term>
493 <listitem><para>Show messages for the
494 specified systemd unit
495 <replaceable>UNIT</replaceable>, or
496 for any of the units matched by
497 <replaceable>PATTERN</replaceable>.
498 If a pattern is specified, a list of
499 unit names found in the journal is
500 compared with the specified pattern
501 and all that match are used. For each
502 unit name, a match is added for
503 messages from the unit
504 (<literal>_SYSTEMD_UNIT=<replaceable>UNIT</replaceable></literal>),
505 along with additional matches for
506 messages from systemd and messages
507 about coredumps for the specified
510 <para>This parameter can be specified
511 multiple times.</para></listitem>
515 <term><option>--user-unit=</option></term>
517 <listitem><para>Show messages for the
518 specified user session unit. This will
519 add a match for messages from the unit
520 (<literal>_SYSTEMD_USER_UNIT=</literal>
521 and <literal>_UID=</literal>) and
522 additional matches for messages from
523 session systemd and messages about
524 coredumps for the specified unit.</para>
525 <para>This parameter can be specified multiple times.
530 <term><option>-p</option></term>
531 <term><option>--priority=</option></term>
533 <listitem><para>Filter output by
534 message priorities or priority
535 ranges. Takes either a single numeric
536 or textual log level (i.e. between
537 0/<literal>emerg</literal> and
538 7/<literal>debug</literal>), or a
539 range of numeric/text log levels in
540 the form FROM..TO. The log levels are
541 the usual syslog log levels as
543 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
544 i.e. <literal>emerg</literal> (0),
545 <literal>alert</literal> (1),
546 <literal>crit</literal> (2),
547 <literal>err</literal> (3),
548 <literal>warning</literal> (4),
549 <literal>notice</literal> (5),
550 <literal>info</literal> (6),
551 <literal>debug</literal> (7). If a
552 single log level is specified, all
553 messages with this log level or a
554 lower (hence more important) log level
555 are shown. If a range is specified, all
556 messages within the range are shown,
557 including both the start and the end
558 value of the range. This will add
559 <literal>PRIORITY=</literal> matches
561 priorities.</para></listitem>
565 <term><option>-c</option></term>
566 <term><option>--cursor=</option></term>
568 <listitem><para>Start showing entries
569 from the location in the journal
570 specified by the passed
571 cursor.</para></listitem>
575 <term><option>--after-cursor=</option></term>
577 <listitem><para>Start showing entries
578 from the location in the journal
579 <emphasis>after</emphasis> the
580 location specified by the this cursor.
581 The cursor is shown when the
582 <option>--show-cursor</option> option
583 is used.</para></listitem>
587 <term><option>--show-cursor</option></term>
589 <listitem><para>The cursor is shown after the last
590 entry after two dashes:</para>
591 <programlisting>-- cursor: s=0639...</programlisting>
592 <para>The format of the cursor is private
593 and subject to change.</para></listitem>
597 <term><option>--since=</option></term>
598 <term><option>--until=</option></term>
600 <listitem><para>Start showing entries
601 on or newer than the specified date,
602 or on or older than the specified
603 date, respectively. Date specifications
604 should be of the format
605 <literal>2012-10-30 18:17:16</literal>.
606 If the time part is omitted,
607 <literal>00:00:00</literal> is assumed.
608 If only the seconds component is omitted,
609 <literal>:00</literal> is assumed. If the
610 date component is omitted, the current
611 day is assumed. Alternatively the strings
612 <literal>yesterday</literal>,
613 <literal>today</literal>,
614 <literal>tomorrow</literal> are
615 understood, which refer to 00:00:00 of
616 the day before the current day, the
617 current day, or the day after the
618 current day, respectively. <literal>now</literal>
619 refers to the current time. Finally,
620 relative times may be specified,
621 prefixed with <literal>-</literal> or
622 <literal>+</literal>, referring to
623 times before or after the current
624 time, respectively.</para></listitem>
628 <term><option>-F</option></term>
629 <term><option>--field=</option></term>
631 <listitem><para>Print all possible
632 data values the specified field can
633 take in all entries of the
634 journal.</para></listitem>
638 <term><option>--system</option></term>
639 <term><option>--user</option></term>
641 <listitem><para>Show messages from
642 system services and the kernel (with
643 <option>--system</option>). Show
644 messages from service of current user
645 (with <option>--user</option>).
646 If neither is specified, show all
647 messages that the user can see.
652 <term><option>-M</option></term>
653 <term><option>--machine=</option></term>
655 <listitem><para>Show messages from a
656 running, local container. Specify a
657 container name to connect
658 to.</para></listitem>
662 <term><option>-D <replaceable>DIR</replaceable></option></term>
663 <term><option>--directory=<replaceable>DIR</replaceable></option></term>
665 <listitem><para>Takes a directory path
666 as argument. If specified, journalctl
667 will operate on the specified journal
669 <replaceable>DIR</replaceable> instead
670 of the default runtime and system
671 journal paths.</para></listitem>
675 <term><option>--file=<replaceable>GLOB</replaceable></option></term>
677 <listitem><para>Takes a file glob as an
678 argument. If specified, journalctl will
679 operate on the specified journal files
680 matching <replaceable>GLOB</replaceable>
681 instead of the default runtime and
682 system journal paths. May be specified
683 multiple times, in which case files will
684 be suitably interleaved.</para></listitem>
688 <term><option>--root=<replaceable>ROOT</replaceable></option></term>
690 <listitem><para>Takes a directory path
691 as an argument. If specified, journalctl
692 will operate on catalog file hierarchy
693 underneath the specified directory
694 instead of the root directory
695 (e.g. <option>--update-catalog</option>
697 <filename><replaceable>ROOT</replaceable>/var/lib/systemd/catalog/database</filename>).
702 <term><option>--new-id128</option></term>
704 <listitem><para>Instead of showing
705 journal contents, generate a new 128-bit
706 ID suitable for identifying
707 messages. This is intended for usage
708 by developers who need a new
709 identifier for a new message they
710 introduce and want to make
711 recognizable. This will print the new ID in
712 three different formats which can be
713 copied into source code or
714 similar.</para></listitem>
718 <term><option>--header</option></term>
720 <listitem><para>Instead of showing
721 journal contents, show internal header
722 information of the journal fields
723 accessed.</para></listitem>
727 <term><option>--disk-usage</option></term>
729 <listitem><para>Shows the current disk
731 journal files.</para></listitem>
735 <term><option>--list-catalog
736 <optional><replaceable>128-bit-ID...</replaceable></optional>
739 <listitem><para>List the contents of
740 the message catalog as a table of
741 message IDs, plus their short
742 description strings.</para>
745 <replaceable>128-bit-ID</replaceable>s are
746 specified, only those entries are shown.
752 <term><option>--dump-catalog
753 <optional><replaceable>128-bit-ID...</replaceable></optional>
756 <listitem><para>Show the contents of
757 the message catalog, with entries
758 separated by a line consisting of two
759 dashes and the ID (the format is the
760 same as <filename>.catalog</filename>
764 <replaceable>128-bit-ID</replaceable>s are
765 specified, only those entries are shown.
771 <term><option>--update-catalog</option></term>
773 <listitem><para>Update the message
774 catalog index. This command needs to
775 be executed each time new catalog
776 files are installed, removed, or
777 updated to rebuild the binary catalog
778 index.</para></listitem>
782 <term><option>--setup-keys</option></term>
784 <listitem><para>Instead of showing
785 journal contents, generate a new key
786 pair for Forward Secure Sealing
787 (FSS). This will generate a sealing
788 key and a verification key. The
789 sealing key is stored in the journal
790 data directory and shall remain on the
791 host. The verification key should be
792 stored externally. Refer to the
793 <option>Seal=</option> option in
794 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
795 for information on Forward Secure
796 Sealing and for a link to a refereed
797 scholarly paper detailing the
798 cryptographic theory it is based on.
803 <term><option>--force</option></term>
806 <option>--setup-keys</option> is passed and
807 Forward Secure Sealing (FSS) has already been
808 configured, recreate FSS keys.</para></listitem>
812 <term><option>--interval=</option></term>
814 <listitem><para>Specifies the change
815 interval for the sealing key when
816 generating an FSS key pair with
817 <option>--setup-keys</option>. Shorter
818 intervals increase CPU consumption but
819 shorten the time range of
821 alterations. Defaults to
822 15min.</para></listitem>
826 <term><option>--verify</option></term>
828 <listitem><para>Check the journal file
829 for internal consistency. If the
830 file has been generated with FSS
831 enabled and the FSS verification key
832 has been specified with
833 <option>--verify-key=</option>,
834 authenticity of the journal file is
835 verified.</para></listitem>
839 <term><option>--verify-key=</option></term>
841 <listitem><para>Specifies the FSS
842 verification key to use for the
843 <option>--verify</option>
844 operation.</para></listitem>
847 <xi:include href="standard-options.xml" xpointer="help" />
848 <xi:include href="standard-options.xml" xpointer="version" />
849 <xi:include href="standard-options.xml" xpointer="no-pager" />
854 <title>Exit status</title>
856 <para>On success, 0 is returned; otherwise, a non-zero
857 failure code is returned.</para>
860 <xi:include href="less-variables.xml" />
863 <title>Examples</title>
865 <para>Without arguments, all collected logs are shown
868 <programlisting>journalctl</programlisting>
870 <para>With one match specified, all entries with a field matching the expression are shown:</para>
872 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service</programlisting>
874 <para>If two different fields are matched, only entries matching both expressions at the same time are shown:</para>
876 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
878 <para>If two matches refer to the same field, all entries matching either expression are shown:</para>
880 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
882 <para>If the separator <literal>+</literal> is used,
883 two expressions may be combined in a logical OR. The
884 following will show all messages from the Avahi
885 service process with the PID 28097 plus all messages
886 from the D-Bus service (from any of its
889 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
891 <para>Show all logs generated by the D-Bus executable:</para>
893 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
895 <para>Show all logs of the kernel device node <filename noindex='true'>/dev/sda</filename>:</para>
897 <programlisting>journalctl /dev/sda</programlisting>
899 <para>Show all kernel logs from previous boot:</para>
901 <programlisting>journalctl -k -b -1</programlisting>
906 <title>See Also</title>
908 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
909 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
910 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
911 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
912 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>