chiark / gitweb /
man: extend systemd.directives(7) to all manual pages
[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>--help</option></term>
118                                 <term><option>-h</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>--all</option></term>
147                                 <term><option>-a</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>--follow</option></term>
157                                 <term><option>-f</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>--lines=</option></term>
167                                 <term><option>-n</option></term>
168
169                                 <listitem><para>Show the most recent
170                                 journal events and limit the number of
171                                 events shown. If
172                                 <option>--follow</option> is used,
173                                 this option is implied. The argument,
174                                 a positive integer, is optional, and
175                                 defaults to 10. </para></listitem>
176                         </varlistentry>
177
178                         <varlistentry>
179                                 <term><option>--no-tail</option></term>
180
181                                 <listitem><para>Show all stored output
182                                 lines, even in follow mode. Undoes the
183                                 effect of
184                                 <option>--lines=</option>.</para></listitem>
185                         </varlistentry>
186
187                         <varlistentry>
188                                 <term><option>--output=</option></term>
189                                 <term><option>-o</option></term>
190
191                                 <listitem><para>Controls the
192                                 formatting of the journal entries that
193                                 are shown. Takes one of
194                                 <literal>short</literal>,
195                                 <literal>short-monotonic</literal>,
196                                 <literal>verbose</literal>,
197                                 <literal>export</literal>,
198                                 <literal>json</literal>,
199                                 <literal>json-pretty</literal>,
200                                 <literal>json-sse</literal>,
201                                 <literal>cat</literal>. <literal>short</literal>
202                                 is the default and generates an output
203                                 that is mostly identical to the
204                                 formatting of classic syslog log
205                                 files, showing one line per journal
206                                 entry. <literal>short-monotonic</literal>
207                                 is very similar but shows monotonic
208                                 timestamps instead of wallclock
209                                 timestamps. <literal>verbose</literal>
210                                 shows the full structured entry items
211                                 with all
212                                 fields. <literal>export</literal>
213                                 serializes the journal into a binary
214                                 (but mostly text-based) stream
215                                 suitable for backups and network
216                                 transfer (see <ulink
217                                 url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
218                                 Export Format</ulink> for more
219                                 information). <literal>json</literal>
220                                 formats entries as JSON data
221                                 structures, one per
222                                 line (see <ulink
223                                 url="http://www.freedesktop.org/wiki/Software/systemd/json">Journal
224                                 JSON Format</ulink> for more
225                                 information). <literal>json-pretty</literal>
226                                 also formats entries as JSON data
227                                 structures, but formats them in
228                                 multiple lines in order to make them
229                                 more readable for
230                                 humans. <literal>json-sse</literal>
231                                 also formats entries as JSON data
232                                 structures, but wraps them in a format
233                                 suitable for <ulink
234                                 url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events">Server-Sent
235                                 Events</ulink>. <literal>cat</literal>
236                                 generates a very terse output only
237                                 showing the actual message of each
238                                 journal entry with no meta data, not
239                                 even a timestamp.</para></listitem>
240                         </varlistentry>
241
242                         <varlistentry>
243                                 <term><option>--catalog</option></term>
244                                 <term><option>-x</option></term>
245
246                                 <listitem><para>Augment log lines with
247                                 explanation texts from the message
248                                 catalog. This will add explanatory
249                                 help texts to log messages in the
250                                 output where this is available. These
251                                 short help texts will explain the
252                                 context of an error or log event,
253                                 possible solutions, as well as
254                                 pointers to support forums, developer
255                                 documentation and any other relevant
256                                 manuals. Note that help texts are not
257                                 available for all messages, but only
258                                 for selected ones. For more
259                                 information on the message catalog
260                                 please refer to the <ulink
261                                 url="http://www.freedesktop.org/wiki/Software/systemd/catalog">Message
262                                 Catalog Developer
263                                 Documentation</ulink>.</para></listitem>
264                         </varlistentry>
265
266                         <varlistentry>
267                                 <term><option>--quiet</option></term>
268                                 <term><option>-q</option></term>
269
270                                 <listitem><para>Suppresses any warning
271                                 message regarding inaccessible system
272                                 journals when run as normal
273                                 user.</para></listitem>
274                         </varlistentry>
275
276                         <varlistentry>
277                                 <term><option>--merge</option></term>
278                                 <term><option>-m</option></term>
279
280                                 <listitem><para>Show entries
281                                 interleaved from all available
282                                 journals, including remote
283                                 ones.</para></listitem>
284                         </varlistentry>
285
286                         <varlistentry>
287                                 <term><option>--this-boot</option></term>
288                                 <term><option>-b</option></term>
289
290                                 <listitem><para>Show data only from
291                                 current boot. This will add a match
292                                 for <literal>_BOOT_ID=</literal> for
293                                 the current boot ID of the
294                                 kernel.</para></listitem>
295                         </varlistentry>
296
297                         <varlistentry>
298                                 <term><option>--unit=</option></term>
299                                 <term><option>-u</option></term>
300
301                                 <listitem><para>Show data only of the
302                                 specified unit. This will add a match
303                                 for <literal>_SYSTEMD_UNIT=</literal>
304                                 for the specified
305                                 unit.</para></listitem>
306                         </varlistentry>
307
308                         <varlistentry>
309                                 <term><option>-p</option></term>
310                                 <term><option>--priority=</option></term>
311
312                                 <listitem><para>Filter output by
313                                 message priorities or priority
314                                 ranges. Takes either a single numeric
315                                 or textual log level (i.e. between
316                                 0/<literal>emerg</literal> and
317                                 7/<literal>debug</literal>), or a
318                                 range of numeric/text log levels in
319                                 the form FROM..TO. The log levels are
320                                 the usual syslog log levels as
321                                 documented in
322                                 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
323                                 i.e. <literal>emerg</literal> (0),
324                                 <literal>alert</literal> (1),
325                                 <literal>crit</literal> (2),
326                                 <literal>err</literal> (3),
327                                 <literal>warning</literal> (4),
328                                 <literal>notice</literal> (5),
329                                 <literal>info</literal> (6),
330                                 <literal>debug</literal> (7). If a
331                                 single log level is specified all
332                                 messages with this log level or a
333                                 lower (hence more important) log level
334                                 are shown. If a range is specified all
335                                 messages within the range are shown,
336                                 including both the start and the end
337                                 value of the range. This will add
338                                 <literal>PRIORITY=</literal> matches
339                                 for the specified
340                                 priorities.</para></listitem>
341                         </varlistentry>
342
343                         <varlistentry>
344                                 <term><option>--cursor=</option></term>
345                                 <term><option>-c</option></term>
346
347                                 <listitem><para>Start showing entries
348                                 from the location in the journal
349                                 specified by the passed
350                                 cursor.</para></listitem>
351                         </varlistentry>
352
353                         <varlistentry>
354                                 <term><option>--since=</option></term>
355                                 <term><option>--until=</option></term>
356
357                                 <listitem><para>Start showing entries
358                                 on or newer than the specified date,
359                                 or on or older than the specified
360                                 date, respectively. Date specifications should be of
361                                 the format "2012-10-30 18:17:16". If
362                                 the time part is omitted, 00:00:00 is
363                                 assumed. If only the seconds component
364                                 is omitted, :00 is assumed. If the
365                                 date component is omitted, the
366                                 current day is assumed. Alternatively
367                                 the strings
368                                 <literal>yesterday</literal>,
369                                 <literal>today</literal>,
370                                 <literal>tomorrow</literal> are
371                                 understood, which refer to 00:00:00 of
372                                 the day before the current day, the
373                                 current day, or the day after the
374                                 current day, respectively. <literal>now</literal>
375                                 refers to the current time. Finally,
376                                 relative times may be specified,
377                                 prefixed with <literal>-</literal> or
378                                 <literal>+</literal>, referring to
379                                 times before or after the current
380                                 time, respectively.</para></listitem>
381                         </varlistentry>
382
383                         <varlistentry>
384                                 <term><option>--field=</option></term>
385                                 <term><option>-F</option></term>
386
387                                 <listitem><para>Print all possible
388                                 data values the specified field can
389                                 take in all entries of the
390                                 journal.</para></listitem>
391                         </varlistentry>
392
393                         <varlistentry>
394                                 <term><option>--directory=</option></term>
395                                 <term><option>-D</option></term>
396
397                                 <listitem><para>Takes an absolute
398                                 directory path as argument. If
399                                 specified journalctl will operate on the
400                                 specified journal directory instead of
401                                 the default runtime and system journal
402                                 paths.</para></listitem>
403                         </varlistentry>
404
405                         <varlistentry>
406                                 <term><option>--new-id128</option></term>
407
408                                 <listitem><para>Instead of showing
409                                 journal contents generate a new 128
410                                 bit ID suitable for identifying
411                                 messages. This is intended for usage
412                                 by developers who need a new
413                                 identifier for a new message they
414                                 introduce and want to make
415                                 recognizable. Will print the new ID in
416                                 three different formats which can be
417                                 copied into source code or
418                                 similar.</para></listitem>
419                         </varlistentry>
420
421                         <varlistentry>
422                                 <term><option>--header</option></term>
423
424                                 <listitem><para>Instead of showing
425                                 journal contents show internal header
426                                 information of the journal fields
427                                 accessed.</para></listitem>
428                         </varlistentry>
429
430                         <varlistentry>
431                                 <term><option>--disk-usage</option></term>
432
433                                 <listitem><para>Shows the current disk
434                                 usage of all
435                                 journal files.</para></listitem>
436                         </varlistentry>
437
438                         <varlistentry>
439                                 <term><option>--list-catalog</option></term>
440
441                                 <listitem><para>List the contents of
442                                 the message catalog, as table of
443                                 message IDs plus their short
444                                 description strings.</para></listitem>
445                         </varlistentry>
446
447                         <varlistentry>
448                                 <term><option>--update-catalog</option></term>
449
450                                 <listitem><para>Update the message
451                                 catalog index. This command needs to
452                                 be executed each time new catalog
453                                 files are installed, removed or
454                                 updated to rebuild the binary catalog
455                                 index.</para></listitem>
456                         </varlistentry>
457
458                         <varlistentry>
459                                 <term><option>--setup-keys</option></term>
460
461                                 <listitem><para>Instead of showing
462                                 journal contents generate a new key
463                                 pair for Forward Secure Sealing
464                                 (FSS). This will generate a sealing
465                                 key and a verification key. The
466                                 sealing key is stored in the journal
467                                 data directory and shall remain on the
468                                 host. The verification key should be
469                                 stored externally.</para></listitem>
470                         </varlistentry>
471
472                         <varlistentry>
473                                 <term><option>--interval=</option></term>
474
475                                 <listitem><para>Specifies the change
476                                 interval for the sealing key, when
477                                 generating an FSS key pair with
478                                 <option>--setup-keys</option>. Shorter
479                                 intervals increase CPU consumption but
480                                 shorten the time range of
481                                 undetectable journal
482                                 alterations. Defaults to
483                                 15min.</para></listitem>
484                         </varlistentry>
485
486                         <varlistentry>
487                                 <term><option>--verify</option></term>
488
489                                 <listitem><para>Check the journal file
490                                 for internal consistency. If the
491                                 file has been generated with FSS
492                                 enabled, and the FSS verification key
493                                 has been specified with
494                                 <option>--verify-key=</option>
495                                 authenticity of the journal file is
496                                 verified.</para></listitem>
497                         </varlistentry>
498
499                         <varlistentry>
500                                 <term><option>--verify-key=</option></term>
501
502                                 <listitem><para>Specifies the FSS
503                                 verification key to use for the
504                                 <option>--verify</option>
505                                 operation.</para></listitem>
506                         </varlistentry>
507
508                 </variablelist>
509         </refsect1>
510
511         <refsect1>
512                 <title>Exit status</title>
513
514                 <para>On success 0 is returned, a non-zero failure
515                 code otherwise.</para>
516         </refsect1>
517
518         <refsect1>
519                 <title>Environment</title>
520
521                 <variablelist class='environment-variables'>
522                         <varlistentry>
523                                 <term><varname>$SYSTEMD_PAGER</varname></term>
524                                 <listitem><para>Pager to use when
525                                 <option>--no-pager</option> is not given;
526                                 overrides <varname>$PAGER</varname>.  Setting
527                                 this to an empty string or the value
528                                 <literal>cat</literal> is equivalent to passing
529                                 <option>--no-pager</option>.</para></listitem>
530                         </varlistentry>
531                 </variablelist>
532         </refsect1>
533
534         <refsect1>
535                 <title>Examples</title>
536
537                 <para>Without arguments all collected logs are shown
538                 unfiltered:</para>
539
540                 <programlisting>journalctl</programlisting>
541
542                 <para>With one match specified all entries with a field matching the expression are shown:</para>
543
544                 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service</programlisting>
545
546                 <para>If two different fields are matched only entries matching both expressions at the same time are shown:</para>
547
548                 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
549
550                 <para>If two matches refer to the same field all entries matching either expression are shown:</para>
551
552                 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
553
554                 <para>If the separator "<literal>+</literal>" is used
555                 two expressions may be combined in a logical OR. The
556                 following will show all messages from the Avahi
557                 service process with the PID 28097 plus all messages
558                 from the D-Bus service (from any of its
559                 processes):</para>
560
561                 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
562
563                 <para>Show all logs generated by the D-Bus executable:</para>
564
565                 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
566
567                 <para>Show all logs of the kernel device node <filename>/dev/sda</filename>:</para>
568
569                 <programlisting>journalctl /dev/sda</programlisting>
570
571         </refsect1>
572
573         <refsect1>
574                 <title>See Also</title>
575                 <para>
576                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
577                         <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
578                         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
579                         <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
580                         <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
581                 </para>
582         </refsect1>
583
584 </refentry>