chiark / gitweb /
pager: introduce "jump to end" option
[elogind.git] / man / journalctl.xml
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">
4
5 <!--
6   This file is part of systemd.
7
8   Copyright 2012 Lennart Poettering
9
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.
14
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.
19
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/>.
22 -->
23
24 <refentry id="journalctl">
25
26         <refentryinfo>
27                 <title>journalctl</title>
28                 <productname>systemd</productname>
29
30                 <authorgroup>
31                         <author>
32                                 <contrib>Developer</contrib>
33                                 <firstname>Lennart</firstname>
34                                 <surname>Poettering</surname>
35                                 <email>lennart@poettering.net</email>
36                         </author>
37                 </authorgroup>
38         </refentryinfo>
39
40         <refmeta>
41                 <refentrytitle>journalctl</refentrytitle>
42                 <manvolnum>1</manvolnum>
43         </refmeta>
44
45         <refnamediv>
46                 <refname>journalctl</refname>
47                 <refpurpose>Query the systemd journal</refpurpose>
48         </refnamediv>
49
50         <refsynopsisdiv>
51                 <cmdsynopsis>
52                         <command>journalctl <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt" rep="repeat">MATCHES</arg></command>
53                 </cmdsynopsis>
54         </refsynopsisdiv>
55
56         <refsect1>
57                 <title>Description</title>
58
59                 <para><command>journalctl</command> may be used to
60                 query the contents of the
61                 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
62                 journal as written by
63                 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
64
65                 <para>If called without parameter it will show the full
66                 contents of the journal, starting with the oldest
67                 entry collected.</para>
68
69                 <para>If one or more match arguments are passed the
70                 output is filtered accordingly. A match is in the
71                 format <literal>FIELD=VALUE</literal>,
72                 e.g. <literal>_SYSTEMD_UNIT=httpd.service</literal>,
73                 referring to the components of a structured journal
74                 entry. See
75                 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
76                 for a list of well-known fields. If multiple matches
77                 are specified matching different fields the log
78                 entries are filtered by both, i.e. the resulting output
79                 will show only entries matching all the specified
80                 matches of this kind. If two matches apply to the same
81                 field, then they are automatically matched as
82                 alternatives, i.e. the resulting output will show
83                 entries matching any of the specified matches for the
84                 same field. Finally, if the character
85                 "<literal>+</literal>" appears as separate word on the
86                 command line all matches before and after are combined
87                 in a disjunction (i.e. logical OR).</para>
88
89                 <para>As shortcuts for a few types of field/value
90                 matches file paths may be specified. If a file path
91                 refers to an executable file, this is equivalent to an
92                 <literal>_EXE=</literal> match for the canonicalized
93                 binary path. Similar, if a path refers to a device
94                 node, this is equivalent to a
95                 <literal>_KERNEL_DEVICE=</literal> match for the
96                 device.</para>
97
98                 <para>Output is interleaved from all accessible
99                 journal files, whether they are rotated or currently
100                 being written, and regardless whether they belong to the
101                 system itself or are accessible user journals.</para>
102
103                 <para>All users are granted access to their private
104                 per-user journals. However, by default only root and
105                 users who are members of the <literal>adm</literal>
106                 group get access to the system journal and the
107                 journals of other users.</para>
108         </refsect1>
109
110         <refsect1>
111                 <title>Options</title>
112
113                 <para>The following options are understood:</para>
114
115                 <variablelist>
116                         <varlistentry>
117                                 <term><option>-h</option></term>
118                                 <term><option>--help</option></term>
119
120                                 <listitem><para>Prints a short help
121                                 text and exits.</para></listitem>
122                         </varlistentry>
123
124                         <varlistentry>
125                                 <term><option>--version</option></term>
126
127                                 <listitem><para>Prints a short version
128                                 string and exits.</para></listitem>
129                         </varlistentry>
130
131                         <varlistentry>
132                                 <term><option>--no-pager</option></term>
133
134                                 <listitem><para>Do not pipe output into a
135                                 pager.</para></listitem>
136                         </varlistentry>
137
138                         <varlistentry>
139                                 <term><option>--full</option></term>
140
141                                 <listitem><para>Show all (printable) fields in
142                                 full.</para></listitem>
143                         </varlistentry>
144
145                         <varlistentry>
146                                 <term><option>-a</option></term>
147                                 <term><option>--all</option></term>
148
149                                 <listitem><para>Show all fields in
150                                 full, even if they include unprintable
151                                 characters or are very
152                                 long.</para></listitem>
153                         </varlistentry>
154
155                         <varlistentry>
156                                 <term><option>-f</option></term>
157                                 <term><option>--follow</option></term>
158
159                                 <listitem><para>Show only the most recent
160                                 journal entries, and continuously print
161                                 new entries as they are appended to
162                                 the journal.</para></listitem>
163                         </varlistentry>
164
165                         <varlistentry>
166                                 <term><option>-e</option></term>
167                                 <term><option>--pager-end</option></term>
168
169                                 <listitem><para>Immediately jump to
170                                 the end of the journal inside the
171                                 implied pager tool. Very useful in
172                                 combination with the
173                                 <option>-b</option> option. Note that
174                                 this is only supported for the
175                                 <citerefentry><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>
176                                 pager.</para></listitem>
177                         </varlistentry>
178
179                         <varlistentry>
180                                 <term><option>-n</option></term>
181                                 <term><option>--lines=</option></term>
182
183                                 <listitem><para>Show the most recent
184                                 journal events and limit the number of
185                                 events shown. If
186                                 <option>--follow</option> is used,
187                                 this option is implied. The argument,
188                                 a positive integer, is optional, and
189                                 defaults to 10. </para></listitem>
190                         </varlistentry>
191
192                         <varlistentry>
193                                 <term><option>--no-tail</option></term>
194
195                                 <listitem><para>Show all stored output
196                                 lines, even in follow mode. Undoes the
197                                 effect of
198                                 <option>--lines=</option>.</para></listitem>
199                         </varlistentry>
200
201                         <varlistentry>
202                                 <term><option>-r</option></term>
203                                 <term><option>--reverse</option></term>
204
205                                 <listitem><para>Reverse output, so the newest
206                                 entries are displayed first.</para></listitem>
207                         </varlistentry>
208
209                         <varlistentry>
210                                 <term><option>-o</option></term>
211                                 <term><option>--output=</option></term>
212
213                                 <listitem><para>Controls the
214                                 formatting of the journal entries that
215                                 are shown. Takes one of
216                                 <literal>short</literal>,
217                                 <literal>short-monotonic</literal>,
218                                 <literal>verbose</literal>,
219                                 <literal>export</literal>,
220                                 <literal>json</literal>,
221                                 <literal>json-pretty</literal>,
222                                 <literal>json-sse</literal>,
223                                 <literal>cat</literal>. <literal>short</literal>
224                                 is the default and generates an output
225                                 that is mostly identical to the
226                                 formatting of classic syslog log
227                                 files, showing one line per journal
228                                 entry. <literal>short-monotonic</literal>
229                                 is very similar but shows monotonic
230                                 timestamps instead of wallclock
231                                 timestamps. <literal>verbose</literal>
232                                 shows the full structured entry items
233                                 with all
234                                 fields. <literal>export</literal>
235                                 serializes the journal into a binary
236                                 (but mostly text-based) stream
237                                 suitable for backups and network
238                                 transfer (see <ulink
239                                 url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
240                                 Export Format</ulink> for more
241                                 information). <literal>json</literal>
242                                 formats entries as JSON data
243                                 structures, one per
244                                 line (see <ulink
245                                 url="http://www.freedesktop.org/wiki/Software/systemd/json">Journal
246                                 JSON Format</ulink> for more
247                                 information). <literal>json-pretty</literal>
248                                 also formats entries as JSON data
249                                 structures, but formats them in
250                                 multiple lines in order to make them
251                                 more readable for
252                                 humans. <literal>json-sse</literal>
253                                 also formats entries as JSON data
254                                 structures, but wraps them in a format
255                                 suitable for <ulink
256                                 url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events">Server-Sent
257                                 Events</ulink>. <literal>cat</literal>
258                                 generates a very terse output only
259                                 showing the actual message of each
260                                 journal entry with no meta data, not
261                                 even a timestamp.</para></listitem>
262                         </varlistentry>
263
264                         <varlistentry>
265                                 <term><option>-x</option></term>
266                                 <term><option>--catalog</option></term>
267
268                                 <listitem><para>Augment log lines with
269                                 explanation texts from the message
270                                 catalog. This will add explanatory
271                                 help texts to log messages in the
272                                 output where this is available. These
273                                 short help texts will explain the
274                                 context of an error or log event,
275                                 possible solutions, as well as
276                                 pointers to support forums, developer
277                                 documentation and any other relevant
278                                 manuals. Note that help texts are not
279                                 available for all messages, but only
280                                 for selected ones. For more
281                                 information on the message catalog
282                                 please refer to the <ulink
283                                 url="http://www.freedesktop.org/wiki/Software/systemd/catalog">Message
284                                 Catalog Developer
285                                 Documentation</ulink>.</para></listitem>
286                         </varlistentry>
287
288                         <varlistentry>
289                                 <term><option>-q</option></term>
290                                 <term><option>--quiet</option></term>
291
292                                 <listitem><para>Suppresses any warning
293                                 message regarding inaccessible system
294                                 journals when run as normal
295                                 user.</para></listitem>
296                         </varlistentry>
297
298                         <varlistentry>
299                                 <term><option>-m</option></term>
300                                 <term><option>--merge</option></term>
301
302                                 <listitem><para>Show entries
303                                 interleaved from all available
304                                 journals, including remote
305                                 ones.</para></listitem>
306                         </varlistentry>
307
308                         <varlistentry>
309                                 <term><option>-b</option></term>
310                                 <term><option>--this-boot</option></term>
311
312                                 <listitem><para>Show data only from
313                                 current boot. This will add a match
314                                 for <literal>_BOOT_ID=</literal> for
315                                 the current boot ID of the
316                                 kernel.</para></listitem>
317                         </varlistentry>
318
319                         <varlistentry>
320                                 <term><option>-u</option></term>
321                                 <term><option>--unit=</option></term>
322
323                                 <listitem><para>Show data only of the
324                                 specified unit. This will add a match
325                                 for <literal>_SYSTEMD_UNIT=</literal>
326                                 for the specified
327                                 unit.</para></listitem>
328                         </varlistentry>
329
330                         <varlistentry>
331                                 <term><option>--user-unit=</option></term>
332
333                                 <listitem><para>Show data only of the
334                                 specified user session unit. This will
335                                 add a match for
336                                 <literal>_SYSTEMD_USER_UNIT=</literal>
337                                 for the specified
338                                 unit.</para></listitem>
339                         </varlistentry>
340
341                         <varlistentry>
342                                 <term><option>-p</option></term>
343                                 <term><option>--priority=</option></term>
344
345                                 <listitem><para>Filter output by
346                                 message priorities or priority
347                                 ranges. Takes either a single numeric
348                                 or textual log level (i.e. between
349                                 0/<literal>emerg</literal> and
350                                 7/<literal>debug</literal>), or a
351                                 range of numeric/text log levels in
352                                 the form FROM..TO. The log levels are
353                                 the usual syslog log levels as
354                                 documented in
355                                 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
356                                 i.e. <literal>emerg</literal> (0),
357                                 <literal>alert</literal> (1),
358                                 <literal>crit</literal> (2),
359                                 <literal>err</literal> (3),
360                                 <literal>warning</literal> (4),
361                                 <literal>notice</literal> (5),
362                                 <literal>info</literal> (6),
363                                 <literal>debug</literal> (7). If a
364                                 single log level is specified all
365                                 messages with this log level or a
366                                 lower (hence more important) log level
367                                 are shown. If a range is specified all
368                                 messages within the range are shown,
369                                 including both the start and the end
370                                 value of the range. This will add
371                                 <literal>PRIORITY=</literal> matches
372                                 for the specified
373                                 priorities.</para></listitem>
374                         </varlistentry>
375
376                         <varlistentry>
377                                 <term><option>-c</option></term>
378                                 <term><option>--cursor=</option></term>
379
380                                 <listitem><para>Start showing entries
381                                 from the location in the journal
382                                 specified by the passed
383                                 cursor.</para></listitem>
384                         </varlistentry>
385
386                         <varlistentry>
387                                 <term><option>--since=</option></term>
388                                 <term><option>--until=</option></term>
389
390                                 <listitem><para>Start showing entries
391                                 on or newer than the specified date,
392                                 or on or older than the specified
393                                 date, respectively. Date specifications should be of
394                                 the format "2012-10-30 18:17:16". If
395                                 the time part is omitted, 00:00:00 is
396                                 assumed. If only the seconds component
397                                 is omitted, :00 is assumed. If the
398                                 date component is omitted, the
399                                 current day is assumed. Alternatively
400                                 the strings
401                                 <literal>yesterday</literal>,
402                                 <literal>today</literal>,
403                                 <literal>tomorrow</literal> are
404                                 understood, which refer to 00:00:00 of
405                                 the day before the current day, the
406                                 current day, or the day after the
407                                 current day, respectively. <literal>now</literal>
408                                 refers to the current time. Finally,
409                                 relative times may be specified,
410                                 prefixed with <literal>-</literal> or
411                                 <literal>+</literal>, referring to
412                                 times before or after the current
413                                 time, respectively.</para></listitem>
414                         </varlistentry>
415
416                         <varlistentry>
417                                 <term><option>-F</option></term>
418                                 <term><option>--field=</option></term>
419
420                                 <listitem><para>Print all possible
421                                 data values the specified field can
422                                 take in all entries of the
423                                 journal.</para></listitem>
424                         </varlistentry>
425
426                         <varlistentry>
427                                 <term><option>-D</option></term>
428                                 <term><option>--directory=</option></term>
429
430                                 <listitem><para>Takes an absolute
431                                 directory path as argument. If
432                                 specified journalctl will operate on the
433                                 specified journal directory instead of
434                                 the default runtime and system journal
435                                 paths.</para></listitem>
436                         </varlistentry>
437
438                         <varlistentry>
439                                 <term><option>--new-id128</option></term>
440
441                                 <listitem><para>Instead of showing
442                                 journal contents generate a new 128
443                                 bit ID suitable for identifying
444                                 messages. This is intended for usage
445                                 by developers who need a new
446                                 identifier for a new message they
447                                 introduce and want to make
448                                 recognizable. Will print the new ID in
449                                 three different formats which can be
450                                 copied into source code or
451                                 similar.</para></listitem>
452                         </varlistentry>
453
454                         <varlistentry>
455                                 <term><option>--header</option></term>
456
457                                 <listitem><para>Instead of showing
458                                 journal contents show internal header
459                                 information of the journal fields
460                                 accessed.</para></listitem>
461                         </varlistentry>
462
463                         <varlistentry>
464                                 <term><option>--disk-usage</option></term>
465
466                                 <listitem><para>Shows the current disk
467                                 usage of all
468                                 journal files.</para></listitem>
469                         </varlistentry>
470
471                         <varlistentry>
472                                 <term><option>--list-catalog</option></term>
473
474                                 <listitem><para>List the contents of
475                                 the message catalog, as table of
476                                 message IDs plus their short
477                                 description strings.</para></listitem>
478                         </varlistentry>
479
480                         <varlistentry>
481                                 <term><option>--update-catalog</option></term>
482
483                                 <listitem><para>Update the message
484                                 catalog index. This command needs to
485                                 be executed each time new catalog
486                                 files are installed, removed or
487                                 updated to rebuild the binary catalog
488                                 index.</para></listitem>
489                         </varlistentry>
490
491                         <varlistentry>
492                                 <term><option>--setup-keys</option></term>
493
494                                 <listitem><para>Instead of showing
495                                 journal contents generate a new key
496                                 pair for Forward Secure Sealing
497                                 (FSS). This will generate a sealing
498                                 key and a verification key. The
499                                 sealing key is stored in the journal
500                                 data directory and shall remain on the
501                                 host. The verification key should be
502                                 stored externally.</para></listitem>
503                         </varlistentry>
504
505                         <varlistentry>
506                                 <term><option>--interval=</option></term>
507
508                                 <listitem><para>Specifies the change
509                                 interval for the sealing key, when
510                                 generating an FSS key pair with
511                                 <option>--setup-keys</option>. Shorter
512                                 intervals increase CPU consumption but
513                                 shorten the time range of
514                                 undetectable journal
515                                 alterations. Defaults to
516                                 15min.</para></listitem>
517                         </varlistentry>
518
519                         <varlistentry>
520                                 <term><option>--verify</option></term>
521
522                                 <listitem><para>Check the journal file
523                                 for internal consistency. If the
524                                 file has been generated with FSS
525                                 enabled, and the FSS verification key
526                                 has been specified with
527                                 <option>--verify-key=</option>
528                                 authenticity of the journal file is
529                                 verified.</para></listitem>
530                         </varlistentry>
531
532                         <varlistentry>
533                                 <term><option>--verify-key=</option></term>
534
535                                 <listitem><para>Specifies the FSS
536                                 verification key to use for the
537                                 <option>--verify</option>
538                                 operation.</para></listitem>
539                         </varlistentry>
540
541                 </variablelist>
542         </refsect1>
543
544         <refsect1>
545                 <title>Exit status</title>
546
547                 <para>On success 0 is returned, a non-zero failure
548                 code otherwise.</para>
549         </refsect1>
550
551         <refsect1>
552                 <title>Environment</title>
553
554                 <variablelist class='environment-variables'>
555                         <varlistentry>
556                                 <term><varname>$SYSTEMD_PAGER</varname></term>
557                                 <listitem><para>Pager to use when
558                                 <option>--no-pager</option> is not given;
559                                 overrides <varname>$PAGER</varname>.  Setting
560                                 this to an empty string or the value
561                                 <literal>cat</literal> is equivalent to passing
562                                 <option>--no-pager</option>.</para></listitem>
563                         </varlistentry>
564                 </variablelist>
565         </refsect1>
566
567         <refsect1>
568                 <title>Examples</title>
569
570                 <para>Without arguments all collected logs are shown
571                 unfiltered:</para>
572
573                 <programlisting>journalctl</programlisting>
574
575                 <para>With one match specified all entries with a field matching the expression are shown:</para>
576
577                 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service</programlisting>
578
579                 <para>If two different fields are matched only entries matching both expressions at the same time are shown:</para>
580
581                 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
582
583                 <para>If two matches refer to the same field all entries matching either expression are shown:</para>
584
585                 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
586
587                 <para>If the separator "<literal>+</literal>" is used
588                 two expressions may be combined in a logical OR. The
589                 following will show all messages from the Avahi
590                 service process with the PID 28097 plus all messages
591                 from the D-Bus service (from any of its
592                 processes):</para>
593
594                 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
595
596                 <para>Show all logs generated by the D-Bus executable:</para>
597
598                 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
599
600                 <para>Show all logs of the kernel device node <filename>/dev/sda</filename>:</para>
601
602                 <programlisting>journalctl /dev/sda</programlisting>
603
604         </refsect1>
605
606         <refsect1>
607                 <title>See Also</title>
608                 <para>
609                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
610                         <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
611                         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
612                         <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
613                         <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
614                 </para>
615         </refsect1>
616
617 </refentry>