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>systemd-journal</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>--no-full</option></term>
156 <term><option>--full</option></term>
157 <term><option>-l</option></term>
159 <listitem><para>Ellipsize fields when
160 they do not fit in available columns.
161 The default is to show full fields,
162 allowing them to wrap or be truncated
163 by the pager if one is used.</para>
165 <para>The old options
166 <option>-l</option>/<option>--full</option>
167 are not useful anymore, except to undo
168 <option>--no-full</option>.</para></listitem>
172 <term><option>-a</option></term>
173 <term><option>--all</option></term>
175 <listitem><para>Show all fields in
176 full, even if they include unprintable
177 characters or are very
178 long.</para></listitem>
182 <term><option>-f</option></term>
183 <term><option>--follow</option></term>
185 <listitem><para>Show only the most recent
186 journal entries, and continuously print
187 new entries as they are appended to
188 the journal.</para></listitem>
192 <term><option>-e</option></term>
193 <term><option>--pager-end</option></term>
195 <listitem><para>Immediately jump to
196 the end of the journal inside the
197 implied pager tool. This implies
198 <option>-n1000</option> to guarantee
199 that the pager will not buffer logs of
200 unbounded size. This may be overridden
201 with an explicit <option>-n</option>
202 with some other numeric value on the
203 command line. Note that this option is
204 only supported for the
205 <citerefentry><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>
206 pager.</para></listitem>
210 <term><option>-n</option></term>
211 <term><option>--lines=</option></term>
213 <listitem><para>Show the most recent
214 journal events and limit the number of
216 <option>--follow</option> is used,
217 this option is implied. The argument,
218 a positive integer, is optional, and
219 defaults to 10. </para></listitem>
223 <term><option>--no-tail</option></term>
225 <listitem><para>Show all stored output
226 lines, even in follow mode. Undoes the
228 <option>--lines=</option>.</para></listitem>
232 <term><option>-r</option></term>
233 <term><option>--reverse</option></term>
235 <listitem><para>Reverse output, so the newest
236 entries are displayed first.</para></listitem>
240 <term><option>-o</option></term>
241 <term><option>--output=</option></term>
243 <listitem><para>Controls the
244 formatting of the journal entries that
245 are shown. Takes one of the following options:
250 <option>short</option>
254 and generates an output
255 that is mostly identical
257 classic syslog files,
259 journal entry.</para>
265 <option>short-iso</option>
268 <para>is very similar,
270 wallclock timestamps.
277 <option>short-precise</option>
280 <para>is very similar,
282 with full microsecond
290 <option>short-monotonic</option>
293 <para>is very similar,
295 timestamps instead of
296 wallclock timestamps.
303 <option>verbose</option>
307 full-structured entry
308 items with all fields.
315 <option>export</option>
319 journal into a binary
320 (but mostly text-based)
324 url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
325 Export Format</ulink>
333 <option>json</option>
336 <para>formats entries
337 as JSON data structures,
338 one per line (see <ulink
339 url="http://www.freedesktop.org/wiki/Software/systemd/json">Journal
340 JSON Format</ulink> for
341 more information).</para>
347 <option>json-pretty</option>
350 <para>formats entries as
351 JSON data structures,
353 multiple lines in order
355 readable for humans.</para>
361 <option>json-sse</option>
364 <para>formats entries as
365 JSON data structures,
367 format suitable for <ulink
368 url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events">Server-Sent
369 Events</ulink>.</para>
378 <para>generates a very
381 message of each journal
382 entry with no meta data,
383 not even a timestamp.
392 <term><option>-x</option></term>
393 <term><option>--catalog</option></term>
395 <listitem><para>Augment log lines with
396 explanation texts from the message
397 catalog. This will add explanatory
398 help texts to log messages in the
399 output where this is available. These
400 short help texts will explain the
401 context of an error or log event,
402 possible solutions, as well as
403 pointers to support forums, developer
404 documentation, and any other relevant
405 manuals. Note that help texts are not
406 available for all messages, but only
407 for selected ones. For more
408 information on the message catalog,
409 please refer to the <ulink
410 url="http://www.freedesktop.org/wiki/Software/systemd/catalog">Message
412 Documentation</ulink>.</para>
414 <para>Note: when attaching
415 <command>journalctl</command> output
416 to bug reports, please do
417 <emphasis>not</emphasis> use
418 <option>-x</option>.</para>
423 <term><option>-q</option></term>
424 <term><option>--quiet</option></term>
426 <listitem><para>Suppresses any warning
427 message regarding inaccessible system
428 journals when run as normal
429 user.</para></listitem>
433 <term><option>-m</option></term>
434 <term><option>--merge</option></term>
436 <listitem><para>Show entries
437 interleaved from all available
438 journals, including remote
439 ones.</para></listitem>
443 <term><option>-b <optional><replaceable>ID</replaceable></optional><optional><replaceable>±offset</replaceable></optional></option></term>
444 <term><option>--boot=<optional><replaceable>ID</replaceable></optional><optional><replaceable>±offset</replaceable></optional></option></term>
446 <listitem><para>Show messages from a specific
447 boot. This will add a match for
448 <literal>_BOOT_ID=</literal>.</para>
450 <para>The argument may be empty, in which case
451 logs for the current boot will be shown.</para>
453 <para>If the boot ID is omitted, a positive
454 <replaceable>offset</replaceable> will look up
455 the boots starting from the beginning of the
456 journal, and a equal-or-less-than zero
457 <replaceable>offset</replaceable> will look up
458 boots starting from the end of the
459 journal. Thus, <constant>1</constant> means the
460 first boot found in the journal in the
461 chronological order, <constant>2</constant> the
462 second and so on; while <constant>-0</constant>
463 is the last boot, <constant>-1</constant> the
464 boot before that, and so on. An empty
465 <replaceable>offset</replaceable> is equivalent
466 to specifying <constant>-0</constant>, except
467 when the current boot is not the last boot
468 (e.g. because <option>--directory</option> was
469 specified to look at logs from a different
472 <para>If the 32 character
473 <replaceable>ID</replaceable> is specified, it
474 may optionally be followed by
475 <replaceable>offset</replaceable> which
476 identifies the boot relative to the one given by
477 boot <replaceable>ID</replaceable>. Negative
478 values mean earlier boots and a positive values
480 <replaceable>offset</replaceable> is not
481 specified, a value of zero is assumed and the
482 logs for the boot given by
483 <replaceable>ID</replaceable> are shown.
490 <term><option>--list-boots</option></term>
492 <listitem><para>Show a tabular list of
493 boot numbers (relative to current
494 boot), their IDs, and the timestamps
495 of the first and last message
496 pertaining to the boot.
501 <term><option>-k</option></term>
502 <term><option>--dmesg</option></term>
504 <listitem><para>Show only kernel messages. This
505 implies <option>-b</option> and adds the match
506 <literal>_TRANSPORT=kernel</literal>.
511 <term><option>-u</option></term>
512 <term><option>--unit=</option></term>
514 <listitem><para>Show messages for the
515 specified systemd unit. This will add
516 a match for messages from the unit
517 (<literal>_SYSTEMD_UNIT=</literal>)
518 and additional matches for messages
519 from systemd and messages about
520 coredumps for the specified unit.</para>
521 <para>This parameter can be specified multiple times.
526 <term><option>--user-unit=</option></term>
528 <listitem><para>Show messages for the
529 specified user session unit. This will
530 add a match for messages from the unit
531 (<literal>_SYSTEMD_USER_UNIT=</literal>
532 and <literal>_UID=</literal>) and
533 additional matches for messages from
534 session systemd and messages about
535 coredumps for the specified unit.</para>
536 <para>This parameter can be specified multiple times.
541 <term><option>-p</option></term>
542 <term><option>--priority=</option></term>
544 <listitem><para>Filter output by
545 message priorities or priority
546 ranges. Takes either a single numeric
547 or textual log level (i.e. between
548 0/<literal>emerg</literal> and
549 7/<literal>debug</literal>), or a
550 range of numeric/text log levels in
551 the form FROM..TO. The log levels are
552 the usual syslog log levels as
554 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
555 i.e. <literal>emerg</literal> (0),
556 <literal>alert</literal> (1),
557 <literal>crit</literal> (2),
558 <literal>err</literal> (3),
559 <literal>warning</literal> (4),
560 <literal>notice</literal> (5),
561 <literal>info</literal> (6),
562 <literal>debug</literal> (7). If a
563 single log level is specified, all
564 messages with this log level or a
565 lower (hence more important) log level
566 are shown. If a range is specified, all
567 messages within the range are shown,
568 including both the start and the end
569 value of the range. This will add
570 <literal>PRIORITY=</literal> matches
572 priorities.</para></listitem>
576 <term><option>-c</option></term>
577 <term><option>--cursor=</option></term>
579 <listitem><para>Start showing entries
580 from the location in the journal
581 specified by the passed
582 cursor.</para></listitem>
586 <term><option>--after-cursor=</option></term>
588 <listitem><para>Start showing entries from the
589 location in the journal
590 <emphasis>after</emphasis> the location
591 specified by the this cursor.
596 <term><option>--since=</option></term>
597 <term><option>--until=</option></term>
599 <listitem><para>Start showing entries
600 on or newer than the specified date,
601 or on or older than the specified
602 date, respectively. Date specifications
603 should be of the format
604 <literal>2012-10-30 18:17:16</literal>.
605 If the time part is omitted,
606 <literal>00:00:00</literal> is assumed.
607 If only the seconds component is omitted,
608 <literal>:00</literal> is assumed. If the
609 date component is omitted, the current
610 day is assumed. Alternatively the strings
611 <literal>yesterday</literal>,
612 <literal>today</literal>,
613 <literal>tomorrow</literal> are
614 understood, which refer to 00:00:00 of
615 the day before the current day, the
616 current day, or the day after the
617 current day, respectively. <literal>now</literal>
618 refers to the current time. Finally,
619 relative times may be specified,
620 prefixed with <literal>-</literal> or
621 <literal>+</literal>, referring to
622 times before or after the current
623 time, respectively.</para></listitem>
627 <term><option>-F</option></term>
628 <term><option>--field=</option></term>
630 <listitem><para>Print all possible
631 data values the specified field can
632 take in all entries of the
633 journal.</para></listitem>
637 <term><option>--system</option></term>
638 <term><option>--user</option></term>
640 <listitem><para>Show messages from
641 system services and the kernel (with
642 <option>--system</option>). Show
643 messages from service of current user
644 (with <option>--user</option>).
645 If neither is specified, show all
646 messages that the user can see.
651 <term><option>-D <replaceable>DIR</replaceable></option></term>
652 <term><option>--directory=<replaceable>DIR</replaceable></option></term>
654 <listitem><para>Takes a directory path
655 as argument. If specified, journalctl
656 will operate on the specified journal
658 <replaceable>DIR</replaceable> instead
659 of the default runtime and system
660 journal paths.</para></listitem>
664 <term><option>--file=<replaceable>GLOB</replaceable></option></term>
666 <listitem><para>Takes a file glob as
667 argument. If specified, journalctl will
668 operate on the specified journal files
669 matching <replaceable>GLOB</replaceable>
670 instead of the default runtime and
671 system journal paths. May be specified
672 multiple times, in which case files will
673 be suitably interleaved.</para></listitem>
677 <term><option>--root=<replaceable>ROOT</replaceable></option></term>
679 <listitem><para>Takes a directory path
680 as argument. If specified, journalctl
681 will operate on catalog file hierarchy
682 underneath the specified directory
683 instead of the root directory
684 (e.g. <option>--update-catalog</option>
686 <filename><replaceable>ROOT</replaceable>/var/lib/systemd/catalog/database</filename>).
691 <term><option>--new-id128</option></term>
693 <listitem><para>Instead of showing
694 journal contents, generate a new 128
695 bit ID suitable for identifying
696 messages. This is intended for usage
697 by developers who need a new
698 identifier for a new message they
699 introduce and want to make
700 recognizable. This will print the new ID in
701 three different formats which can be
702 copied into source code or
703 similar.</para></listitem>
707 <term><option>--header</option></term>
709 <listitem><para>Instead of showing
710 journal contents, show internal header
711 information of the journal fields
712 accessed.</para></listitem>
716 <term><option>--disk-usage</option></term>
718 <listitem><para>Shows the current disk
720 journal files.</para></listitem>
724 <term><option>--list-catalog
725 <optional><replaceable>ID128...</replaceable></optional>
728 <listitem><para>List the contents of
729 the message catalog, as table of
730 message IDs plus their short
731 description strings.</para>
734 <replaceable>ID128</replaceable>s are
735 specified, only those entries are shown.
741 <term><option>--dump-catalog
742 <optional><replaceable>ID128...</replaceable></optional>
745 <listitem><para>Show the contents of
746 the message catalog, with entries
747 separated by a line consisting of two
748 dashes and the id (the format is the
749 same as <filename>.catalog</filename>
753 <replaceable>ID128</replaceable>s are
754 specified, only those entries are shown.
760 <term><option>--update-catalog</option></term>
762 <listitem><para>Update the message
763 catalog index. This command needs to
764 be executed each time new catalog
765 files are installed, removed or
766 updated to rebuild the binary catalog
767 index.</para></listitem>
771 <term><option>--setup-keys</option></term>
773 <listitem><para>Instead of showing
774 journal contents, generate a new key
775 pair for Forward Secure Sealing
776 (FSS). This will generate a sealing
777 key and a verification key. The
778 sealing key is stored in the journal
779 data directory and shall remain on the
780 host. The verification key should be
781 stored externally. Also see the
782 <option>Seal=</option> option in
783 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
784 for details.</para></listitem>
788 <term><option>--force</option></term>
790 <listitem><para>When --setup-keys is passed and
791 Forward Secure Sealing has already been set up,
792 recreate FSS keys.</para></listitem>
796 <term><option>--interval=</option></term>
798 <listitem><para>Specifies the change
799 interval for the sealing key when
800 generating an FSS key pair with
801 <option>--setup-keys</option>. Shorter
802 intervals increase CPU consumption but
803 shorten the time range of
805 alterations. Defaults to
806 15min.</para></listitem>
810 <term><option>--verify</option></term>
812 <listitem><para>Check the journal file
813 for internal consistency. If the
814 file has been generated with FSS
815 enabled and the FSS verification key
816 has been specified with
817 <option>--verify-key=</option>,
818 authenticity of the journal file is
819 verified.</para></listitem>
823 <term><option>--verify-key=</option></term>
825 <listitem><para>Specifies the FSS
826 verification key to use for the
827 <option>--verify</option>
828 operation.</para></listitem>
835 <title>Exit status</title>
837 <para>On success, 0 is returned, a non-zero failure
838 code otherwise.</para>
842 <title>Environment</title>
844 <variablelist class='environment-variables'>
846 <term><varname>$SYSTEMD_PAGER</varname></term>
847 <listitem><para>Pager to use when
848 <option>--no-pager</option> is not given;
849 overrides <varname>$PAGER</varname>. Setting
850 this to an empty string or the value
851 <literal>cat</literal> is equivalent to passing
852 <option>--no-pager</option>.</para></listitem>
858 <title>Examples</title>
860 <para>Without arguments, all collected logs are shown
863 <programlisting>journalctl</programlisting>
865 <para>With one match specified, all entries with a field matching the expression are shown:</para>
867 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service</programlisting>
869 <para>If two different fields are matched, only entries matching both expressions at the same time are shown:</para>
871 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
873 <para>If two matches refer to the same field, all entries matching either expression are shown:</para>
875 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
877 <para>If the separator <literal>+</literal> is used,
878 two expressions may be combined in a logical OR. The
879 following will show all messages from the Avahi
880 service process with the PID 28097 plus all messages
881 from the D-Bus service (from any of its
884 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
886 <para>Show all logs generated by the D-Bus executable:</para>
888 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
890 <para>Show all logs of the kernel device node <filename noindex='true'>/dev/sda</filename>:</para>
892 <programlisting>journalctl /dev/sda</programlisting>
894 <para>Show all kernel logs from previous boot:</para>
896 <programlisting>journalctl -k -b -1</programlisting>
901 <title>See Also</title>
903 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
904 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
905 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
906 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
907 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>