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