]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/journalctl.xml
Revert "journal: Add --convert= command to journalctl"
[thirdparty/systemd.git] / man / journalctl.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="journalctl"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>journalctl</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>journalctl</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>journalctl</refname>
21 <refpurpose>Query the systemd journal</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <cmdsynopsis>
26 <command>journalctl</command>
27 <arg choice="opt" rep="repeat">OPTIONS</arg>
28 <arg choice="opt" rep="repeat">MATCHES</arg>
29 </cmdsynopsis>
30 </refsynopsisdiv>
31
32 <refsect1>
33 <title>Description</title>
34
35 <para><command>journalctl</command> may be used to query the contents of the
36 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> journal as
37 written by
38 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
39
40 <para>If called without parameters, it will show the full contents of the journal, starting with the
41 oldest entry collected.</para>
42
43 <para>If one or more match arguments are passed, the output is filtered accordingly. A match is in the
44 format <literal>FIELD=VALUE</literal>, e.g. <literal>_SYSTEMD_UNIT=httpd.service</literal>, referring to
45 the components of a structured journal entry. See
46 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
47 for a list of well-known fields. If multiple matches are specified matching different fields, the log
48 entries are filtered by both, i.e. the resulting output will show only entries matching all the specified
49 matches of this kind. If two matches apply to the same field, then they are automatically matched as
50 alternatives, i.e. the resulting output will show entries matching any of the specified matches for the
51 same field. Finally, the character <literal>+</literal> may appear as a separate word between other terms
52 on the command line. This causes all matches before and after to be combined in a disjunction
53 (i.e. logical OR).</para>
54
55 <para>It is also possible to filter the entries by specifying an absolute file path as an argument. The
56 file path may be a file or a symbolic link and the file must exist at the time of the query. If a file
57 path refers to an executable binary, an <literal>_EXE=</literal> match for the canonicalized binary path
58 is added to the query. If a file path refers to an executable script, a <literal>_COMM=</literal> match
59 for the script name is added to the query. If a file path refers to a device node,
60 <literal>_KERNEL_DEVICE=</literal> matches for the kernel name of the device and for each of its ancestor
61 devices is added to the query. Symbolic links are dereferenced, kernel names are synthesized, and parent
62 devices are identified from the environment at the time of the query. In general, a device node is the
63 best proxy for an actual device, as log entries do not usually contain fields that identify an actual
64 device. For the resulting log entries to be correct for the actual device, the relevant parts of the
65 environment at the time the entry was logged, in particular the actual device corresponding to the device
66 node, must have been the same as those at the time of the query. Because device nodes generally change
67 their corresponding devices across reboots, specifying a device node path causes the resulting entries to
68 be restricted to those from the current boot.</para>
69
70 <para>Additional constraints may be added using options <option>--boot</option>,
71 <option>--unit=</option>, etc., to further limit what entries will be shown (logical AND).</para>
72
73 <para>Output is interleaved from all accessible journal files, whether they are rotated or currently
74 being written, and regardless of whether they belong to the system itself or are accessible user
75 journals. The <option>--header</option> option can be used to identify which files
76 <emphasis>are</emphasis> being shown.</para>
77
78 <para>The set of journal files which will be used can be modified using the <option>--user</option>,
79 <option>--system</option>, <option>--directory</option>, and <option>--file</option> options, see
80 below.</para>
81
82 <para>All users are granted access to their private per-user journals. However, by default, only root and
83 users who are members of a few special groups are granted access to the system journal and the journals
84 of other users. Members of the groups <literal>systemd-journal</literal>, <literal>adm</literal>, and
85 <literal>wheel</literal> can read all journal files. Note that the two latter groups traditionally have
86 additional privileges specified by the distribution. Members of the <literal>wheel</literal> group can
87 often perform administrative tasks.</para>
88
89 <para>The output is paged through <command>less</command> by default, and long lines are "truncated" to
90 screen width. The hidden part can be viewed by using the left-arrow and right-arrow keys. Paging can be
91 disabled; see the <option>--no-pager</option> option and the "Environment" section below.</para>
92
93 <para>When outputting to a tty, lines are colored according to priority: lines of level ERROR and higher
94 are colored red; lines of level NOTICE and higher are highlighted; lines of level DEBUG are colored
95 lighter grey; other lines are displayed normally.</para>
96 </refsect1>
97
98 <refsect1>
99 <title>Source Options</title>
100
101 <para>The following options control where to read journal records from:</para>
102
103 <variablelist>
104 <varlistentry>
105 <term><option>--system</option></term>
106 <term><option>--user</option></term>
107
108 <listitem><para>Show messages from system services and the kernel (with
109 <option>--system</option>). Show messages from service of current user (with
110 <option>--user</option>). If neither is specified, show all messages that the user can see.
111 </para></listitem>
112 </varlistentry>
113
114 <varlistentry>
115 <term><option>-M</option></term>
116 <term><option>--machine=</option></term>
117
118 <listitem><para>Show messages from a running, local container. Specify a container name to connect
119 to.</para></listitem>
120 </varlistentry>
121
122 <varlistentry>
123 <term><option>-m</option></term>
124 <term><option>--merge</option></term>
125
126 <listitem><para>Show entries interleaved from all available journals, including remote
127 ones.</para></listitem>
128 </varlistentry>
129
130 <varlistentry>
131 <term><option>-D <replaceable>DIR</replaceable></option></term>
132 <term><option>--directory=<replaceable>DIR</replaceable></option></term>
133
134 <listitem><para>Takes a directory path as argument. If specified, journalctl will operate on the
135 specified journal directory <replaceable>DIR</replaceable> instead of the default runtime and system
136 journal paths.</para></listitem>
137 </varlistentry>
138
139 <varlistentry>
140 <term><option>--file=<replaceable>GLOB</replaceable></option></term>
141
142 <listitem><para>Takes a file glob as an argument. If specified, journalctl will operate on the
143 specified journal files matching <replaceable>GLOB</replaceable> instead of the default runtime and
144 system journal paths. May be specified multiple times, in which case files will be suitably
145 interleaved.</para></listitem>
146 </varlistentry>
147
148 <varlistentry>
149 <term><option>--root=<replaceable>ROOT</replaceable></option></term>
150
151 <listitem><para>Takes a directory path as an argument. If specified, <command>journalctl</command>
152 will operate on journal directories and catalog file hierarchy underneath the specified directory
153 instead of the root directory (e.g. <option>--update-catalog</option> will create
154 <filename><replaceable>ROOT</replaceable>/var/lib/systemd/catalog/database</filename>, and journal
155 files under <filename><replaceable>ROOT</replaceable>/run/journal/</filename> or
156 <filename><replaceable>ROOT</replaceable>/var/log/journal/</filename> will be displayed).
157 </para></listitem>
158 </varlistentry>
159
160 <varlistentry>
161 <term><option>--image=<replaceable>IMAGE</replaceable></option></term>
162
163 <listitem><para>Takes a path to a disk image file or block device node. If specified,
164 <command>journalctl</command> will operate on the file system in the indicated disk image. This
165 option is similar to <option>--root=</option>, but operates on file systems stored in disk images or
166 block devices, thus providing an easy way to extract log data from disk images. The disk image should
167 either contain just a file system or a set of file systems within a GPT partition table, following
168 the <ulink url="https://systemd.io/DISCOVERABLE_PARTITIONS">Discoverable Partitions
169 Specification</ulink>. For further information on supported disk images, see
170 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
171 switch of the same name.</para></listitem>
172 </varlistentry>
173
174 <varlistentry>
175 <term><option>--namespace=<replaceable>NAMESPACE</replaceable></option></term>
176
177 <listitem><para>Takes a journal namespace identifier string as argument. If not specified the data
178 collected by the default namespace is shown. If specified shows the log data of the specified
179 namespace instead. If the namespace is specified as <literal>*</literal> data from all namespaces is
180 shown, interleaved. If the namespace identifier is prefixed with <literal>+</literal> data from the
181 specified namespace and the default namespace is shown, interleaved, but no other. For details about
182 journal namespaces see
183 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para></listitem>
184 </varlistentry>
185 </variablelist>
186 </refsect1>
187
188 <refsect1>
189 <title>Filtering Options</title>
190
191 <para>The following options control how to filter journal records:</para>
192
193 <variablelist>
194 <varlistentry>
195 <term><option>-S</option></term>
196 <term><option>--since=</option></term>
197 <term><option>-U</option></term>
198 <term><option>--until=</option></term>
199
200 <listitem><para>Start showing entries on or newer than the specified date, or on or older than the
201 specified date, respectively. Date specifications should be of the format <literal>2012-10-30
202 18:17:16</literal>. If the time part is omitted, <literal>00:00:00</literal> is assumed. If only
203 the seconds component is omitted, <literal>:00</literal> is assumed. If the date component is
204 omitted, the current day is assumed. Alternatively the strings <literal>yesterday</literal>,
205 <literal>today</literal>, <literal>tomorrow</literal> are understood, which refer to 00:00:00 of the
206 day before the current day, the current day, or the day after the current day,
207 respectively. <literal>now</literal> refers to the current time. Finally, relative times may be
208 specified, prefixed with <literal>-</literal> or <literal>+</literal>, referring to times before or
209 after the current time, respectively. For complete time and date specification, see
210 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>. Note
211 that <option>--output=short-full</option> prints timestamps that follow precisely this format.
212 </para></listitem>
213 </varlistentry>
214
215 <varlistentry>
216 <term><option>-c</option></term>
217 <term><option>--cursor=</option></term>
218
219 <listitem><para>Start showing entries from the location in the journal specified by the passed
220 cursor.</para></listitem>
221 </varlistentry>
222
223 <varlistentry>
224 <term><option>--after-cursor=</option></term>
225
226 <listitem><para>Start showing entries from the location in the journal <emphasis>after</emphasis>
227 the location specified by the passed cursor. The cursor is shown when the
228 <option>--show-cursor</option> option is used.</para></listitem>
229 </varlistentry>
230
231 <varlistentry>
232 <term><option>--cursor-file=<replaceable>FILE</replaceable></option></term>
233
234 <listitem><para>If <replaceable>FILE</replaceable> exists and contains a cursor, start showing
235 entries <emphasis>after</emphasis> this location. Otherwise show entries according to the other
236 given options. At the end, write the cursor of the last entry to
237 <replaceable>FILE</replaceable>. Use this option to continually read the journal by sequentially
238 calling <command>journalctl</command>.</para></listitem>
239 </varlistentry>
240
241 <varlistentry>
242 <term><option>-b <optional><optional><replaceable>ID</replaceable></optional><optional><replaceable>±offset</replaceable></optional>|<constant>all</constant></optional></option></term>
243 <term><option>--boot<optional>=<optional><replaceable>ID</replaceable></optional><optional><replaceable>±offset</replaceable></optional>|<constant>all</constant></optional></option></term>
244
245 <listitem><para>Show messages from a specific boot. This will add a match for
246 <literal>_BOOT_ID=</literal>.</para>
247
248 <para>The argument may be empty, in which case logs for the current boot will be shown.</para>
249
250 <para>If the boot ID is omitted, a positive <replaceable>offset</replaceable> will look up the boots
251 starting from the beginning of the journal, and an equal-or-less-than zero
252 <replaceable>offset</replaceable> will look up boots starting from the end of the journal. Thus,
253 <constant>1</constant> means the first boot found in the journal in chronological order,
254 <constant>2</constant> the second and so on; while <constant>-0</constant> is the last boot,
255 <constant>-1</constant> the boot before last, and so on. An empty <replaceable>offset</replaceable>
256 is equivalent to specifying <constant>-0</constant>, except when the current boot is not the last
257 boot (e.g. because <option>--directory</option> was specified to look at logs from a different
258 machine).</para>
259
260 <para>If the 32-character <replaceable>ID</replaceable> is specified, it may optionally be followed
261 by <replaceable>offset</replaceable> which identifies the boot relative to the one given by boot
262 <replaceable>ID</replaceable>. Negative values mean earlier boots and positive values mean later
263 boots. If <replaceable>offset</replaceable> is not specified, a value of zero is assumed, and the
264 logs for the boot given by <replaceable>ID</replaceable> are shown.</para>
265
266 <para>The special argument <constant>all</constant> can be used to negate the effect of an earlier
267 use of <option>-b</option>.</para></listitem>
268 </varlistentry>
269
270 <varlistentry>
271 <term><option>-u</option></term>
272 <term><option>--unit=<replaceable>UNIT</replaceable>|<replaceable>PATTERN</replaceable></option></term>
273
274 <listitem><para>Show messages for the specified systemd unit <replaceable>UNIT</replaceable> (such as
275 a service unit), or for any of the units matched by <replaceable>PATTERN</replaceable>. If a pattern
276 is specified, a list of unit names found in the journal is compared with the specified pattern and
277 all that match are used. For each unit name, a match is added for messages from the unit
278 (<literal>_SYSTEMD_UNIT=<replaceable>UNIT</replaceable></literal>), along with additional matches for
279 messages from systemd and messages about coredumps for the specified unit. A match is also added for
280 <literal>_SYSTEMD_SLICE=<replaceable>UNIT</replaceable></literal>, such that if the provided
281 <replaceable>UNIT</replaceable> is a
282 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>
283 unit, all logs of children of the slice will be shown.</para>
284
285 <para>This parameter can be specified multiple times.</para></listitem>
286 </varlistentry>
287
288 <varlistentry>
289 <term><option>--user-unit=</option></term>
290
291 <listitem><para>Show messages for the specified user session unit. This will add a match for messages
292 from the unit (<literal>_SYSTEMD_USER_UNIT=</literal> and <literal>_UID=</literal>) and additional
293 matches for messages from session systemd and messages about coredumps for the specified unit. A
294 match is also added for <literal>_SYSTEMD_USER_SLICE=<replaceable>UNIT</replaceable></literal>, such
295 that if the provided <replaceable>UNIT</replaceable> is a
296 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>
297 unit, all logs of children of the unit will be shown.</para>
298
299 <para>This parameter can be specified multiple times.</para></listitem>
300 </varlistentry>
301
302 <varlistentry>
303 <term><option>-t</option></term>
304 <term><option>--identifier=<replaceable>SYSLOG_IDENTIFIER</replaceable></option></term>
305
306 <listitem><para>Show messages for the specified syslog identifier
307 <replaceable>SYSLOG_IDENTIFIER</replaceable>.</para>
308
309 <para>This parameter can be specified multiple times.</para></listitem>
310 </varlistentry>
311
312 <varlistentry>
313 <term><option>-p</option></term>
314 <term><option>--priority=</option></term>
315
316 <listitem><para>Filter output by message priorities or priority ranges. Takes either a single numeric
317 or textual log level (i.e. between 0/<literal>emerg</literal> and 7/<literal>debug</literal>), or a
318 range of numeric/text log levels in the form FROM..TO. The log levels are the usual syslog log levels
319 as documented in <citerefentry
320 project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
321 i.e. <literal>emerg</literal> (0), <literal>alert</literal> (1), <literal>crit</literal> (2),
322 <literal>err</literal> (3), <literal>warning</literal> (4), <literal>notice</literal> (5),
323 <literal>info</literal> (6), <literal>debug</literal> (7). If a single log level is specified, all
324 messages with this log level or a lower (hence more important) log level are shown. If a range is
325 specified, all messages within the range are shown, including both the start and the end value of the
326 range. This will add <literal>PRIORITY=</literal> matches for the specified
327 priorities.</para></listitem>
328 </varlistentry>
329
330 <varlistentry>
331 <term><option>--facility=</option></term>
332
333 <listitem><para>Filter output by syslog facility. Takes a comma-separated list of numbers or
334 facility names. The names are the usual syslog facilities as documented in <citerefentry
335 project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
336 <option>--facility=help</option> may be used to display a list of known facility names and exit.
337 </para></listitem>
338 </varlistentry>
339
340 <varlistentry>
341 <term><option>-g</option></term>
342 <term><option>--grep=</option></term>
343
344 <listitem><para>Filter output to entries where the <varname>MESSAGE=</varname> field matches the
345 specified regular expression. PERL-compatible regular expressions are used, see <citerefentry
346 project='url'><refentrytitle
347 url='http://pcre.org/current/doc/html/pcre2pattern.html'>pcre2pattern</refentrytitle><manvolnum>3</manvolnum></citerefentry>
348 for a detailed description of the syntax.</para>
349
350 <para>If the pattern is all lowercase, matching is case insensitive. Otherwise, matching is case
351 sensitive. This can be overridden with the <option>--case-sensitive</option> option, see
352 below.</para></listitem>
353 </varlistentry>
354
355 <varlistentry>
356 <term><option>--case-sensitive<optional>=BOOLEAN</optional></option></term>
357
358 <listitem><para>Make pattern matching case sensitive or case insensitive.</para></listitem>
359 </varlistentry>
360
361 <varlistentry>
362 <term><option>-k</option></term>
363 <term><option>--dmesg</option></term>
364
365 <listitem><para>Show only kernel messages. This implies <option>-b</option> and adds the match
366 <literal>_TRANSPORT=kernel</literal>.</para></listitem>
367 </varlistentry>
368 </variablelist>
369 </refsect1>
370
371 <refsect1>
372 <title>Output Options</title>
373
374 <para>The following options control how journal records are printed:</para>
375
376 <variablelist>
377 <varlistentry>
378 <term><option>-o</option></term>
379 <term><option>--output=</option></term>
380
381 <listitem><para>Controls the formatting of the journal entries that are shown. Takes one of the
382 following options:</para>
383
384 <variablelist>
385 <varlistentry>
386 <term><option>short</option></term>
387 <listitem><para>is the default and generates an output that is mostly identical to the
388 formatting of classic syslog files, showing one line per journal entry.</para></listitem>
389 </varlistentry>
390
391 <varlistentry>
392 <term><option>short-full</option></term>
393 <listitem><para>is very similar, but shows timestamps in the format the
394 <option>--since=</option> and <option>--until=</option> options accept. Unlike the timestamp
395 information shown in <option>short</option> output mode this mode includes weekday, year and
396 timezone information in the output, and is locale-independent.</para></listitem>
397 </varlistentry>
398
399 <varlistentry>
400 <term><option>short-iso</option></term>
401 <listitem><para>is very similar, but shows ISO 8601 wallclock timestamps.</para></listitem>
402 </varlistentry>
403
404 <varlistentry>
405 <term><option>short-iso-precise</option></term>
406 <listitem><para>as for <option>short-iso</option> but includes full microsecond
407 precision.</para></listitem>
408 </varlistentry>
409
410 <varlistentry>
411 <term><option>short-precise</option></term>
412 <listitem><para>is very similar, but shows classic syslog timestamps with full microsecond
413 precision.</para></listitem>
414 </varlistentry>
415
416 <varlistentry>
417 <term><option>short-monotonic</option></term>
418 <listitem><para>is very similar, but shows monotonic timestamps instead of wallclock
419 timestamps.</para></listitem>
420 </varlistentry>
421
422 <varlistentry>
423 <term><option>short-delta</option></term>
424 <listitem><para>as for <option>short-monotonic</option> but includes the time difference
425 to the previous entry.
426 Maybe unreliable time differences are marked by a <literal>*</literal>.</para></listitem>
427 </varlistentry>
428
429 <varlistentry>
430 <term><option>short-unix</option></term>
431 <listitem><para>is very similar, but shows seconds passed since January 1st 1970 UTC instead of
432 wallclock timestamps ("UNIX time"). The time is shown with microsecond accuracy.</para></listitem>
433 </varlistentry>
434
435 <varlistentry>
436 <term><option>verbose</option></term>
437 <listitem><para>shows the full-structured entry items with all fields.</para></listitem>
438 </varlistentry>
439
440 <varlistentry>
441 <term><option>export</option></term>
442 <listitem><para>serializes the journal into a binary (but mostly text-based) stream suitable
443 for backups and network transfer (see <ulink
444 url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export
445 Format</ulink> for more information). To import the binary stream back into native journald
446 format use
447 <citerefentry><refentrytitle>systemd-journal-remote</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para></listitem>
448 </varlistentry>
449
450 <varlistentry>
451 <term><option>json</option></term>
452 <listitem><para>formats entries as JSON objects, separated by newline characters (see <ulink
453 url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format">Journal JSON Format</ulink>
454 for more information). Field values are generally encoded as JSON strings, with three exceptions:
455 <orderedlist>
456 <listitem><para>Fields larger than 4096 bytes are encoded as <constant>null</constant>
457 values. (This may be turned off by passing <option>--all</option>, but be aware that this may
458 allocate overly long JSON objects.)</para></listitem>
459
460 <listitem><para>Journal entries permit non-unique fields within the same log entry. JSON does
461 not allow non-unique fields within objects. Due to this, if a non-unique field is encountered a
462 JSON array is used as field value, listing all field values as elements.</para></listitem>
463
464 <listitem><para>Fields containing non-printable or non-UTF8 bytes are encoded as arrays
465 containing the raw bytes individually formatted as unsigned numbers.</para></listitem>
466 </orderedlist>
467
468 Note that this encoding is reversible (with the exception of the size limit).</para></listitem>
469 </varlistentry>
470
471 <varlistentry>
472 <term><option>json-pretty</option></term>
473 <listitem><para>formats entries as JSON data structures, but formats them in multiple lines in
474 order to make them more readable by humans.</para></listitem>
475 </varlistentry>
476
477 <varlistentry>
478 <term><option>json-sse</option></term>
479 <listitem><para>formats entries as JSON data structures, but wraps them in a format suitable for
480 <ulink
481 url="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events">Server-Sent
482 Events</ulink>.</para></listitem>
483 </varlistentry>
484
485 <varlistentry>
486 <term><option>json-seq</option></term>
487 <listitem><para>formats entries as JSON data structures, but prefixes them with an ASCII Record
488 Separator character (0x1E) and suffixes them with an ASCII Line Feed character (0x0A), in
489 accordance with <ulink url="https://tools.ietf.org/html/rfc7464">JavaScript Object Notation
490 (JSON) Text Sequences </ulink> (<literal>application/json-seq</literal>).</para></listitem>
491 </varlistentry>
492
493 <varlistentry>
494 <term><option>cat</option></term>
495 <listitem><para>generates a very terse output, only showing the actual message of each journal
496 entry with no metadata, not even a timestamp. If combined with the
497 <option>--output-fields=</option> option will output the listed fields for each log record,
498 instead of the message.</para></listitem>
499 </varlistentry>
500
501 <varlistentry>
502 <term><option>with-unit</option></term>
503 <listitem><para>similar to <option>short-full</option>, but prefixes the unit and user unit names
504 instead of the traditional syslog identifier. Useful when using templated instances, as it will
505 include the arguments in the unit names.</para></listitem>
506 </varlistentry>
507 </variablelist></listitem>
508 </varlistentry>
509
510 <varlistentry>
511 <term><option>--output-fields=</option></term>
512
513 <listitem><para>A comma separated list of the fields which should be included in the output. This
514 has an effect only for the output modes which would normally show all fields
515 (<option>verbose</option>, <option>export</option>, <option>json</option>,
516 <option>json-pretty</option>, <option>json-sse</option> and <option>json-seq</option>), as well as
517 on <option>cat</option>. For the former, the <literal>__CURSOR</literal>,
518 <literal>__REALTIME_TIMESTAMP</literal>, <literal>__MONOTONIC_TIMESTAMP</literal>, and
519 <literal>_BOOT_ID</literal> fields are always printed.</para></listitem>
520 </varlistentry>
521
522 <varlistentry>
523 <term><option>-n</option></term>
524 <term><option>--lines=</option></term>
525
526 <listitem><para>Show the most recent journal events and limit the number of events shown. If
527 <option>--follow</option> is used, this option is implied. The argument is a positive integer or
528 <literal>all</literal> to disable line limiting. The default value is 10 if no argument is
529 given.</para></listitem>
530 </varlistentry>
531
532 <varlistentry>
533 <term><option>-r</option></term>
534 <term><option>--reverse</option></term>
535
536 <listitem><para>Reverse output so that the newest entries are displayed first.</para></listitem>
537 </varlistentry>
538
539 <varlistentry>
540 <term><option>--show-cursor</option></term>
541
542 <listitem><para>The cursor is shown after the last entry after two dashes:</para>
543 <programlisting>-- cursor: s=0639</programlisting>
544 <para>The format of the cursor is private and subject to change.</para></listitem>
545 </varlistentry>
546
547 <varlistentry>
548 <term><option>--utc</option></term>
549
550 <listitem><para>Express time in Coordinated Universal Time (UTC).</para></listitem>
551 </varlistentry>
552
553 <varlistentry>
554 <term><option>-x</option></term>
555 <term><option>--catalog</option></term>
556
557 <listitem><para>Augment log lines with explanation texts from the message catalog. This will add
558 explanatory help texts to log messages in the output where this is available. These short help texts
559 will explain the context of an error or log event, possible solutions, as well as pointers to support
560 forums, developer documentation, and any other relevant manuals. Note that help texts are not
561 available for all messages, but only for selected ones. For more information on the message catalog,
562 please refer to the <ulink url="https://www.freedesktop.org/wiki/Software/systemd/catalog">Message
563 Catalog Developer Documentation</ulink>.</para>
564
565 <para>Note: when attaching <command>journalctl</command> output to bug reports, please do
566 <emphasis>not</emphasis> use <option>-x</option>.</para></listitem>
567 </varlistentry>
568
569 <varlistentry>
570 <term><option>--no-hostname</option></term>
571
572 <listitem><para>Don't show the hostname field of log messages originating from the local host. This
573 switch has an effect only on the <option>short</option> family of output modes (see above).</para>
574
575 <para>Note: this option does not remove occurrences of the hostname from log entries themselves, so
576 it does not prevent the hostname from being visible in the logs.</para></listitem>
577 </varlistentry>
578
579 <varlistentry>
580 <term><option>--no-full</option></term>
581 <term><option>--full</option></term>
582 <term><option>-l</option></term>
583
584 <listitem><para>Ellipsize fields when they do not fit in available columns. The default is to show
585 full fields, allowing them to wrap or be truncated by the pager, if one is used.</para>
586
587 <para>The old options <option>-l</option>/<option>--full</option> are not useful anymore, except to
588 undo <option>--no-full</option>.</para></listitem>
589 </varlistentry>
590
591 <varlistentry>
592 <term><option>-a</option></term>
593 <term><option>--all</option></term>
594
595 <listitem><para>Show all fields in full, even if they include unprintable characters or are very
596 long. By default, fields with unprintable characters are abbreviated as "blob data". (Note that the
597 pager may escape unprintable characters again.)</para></listitem>
598 </varlistentry>
599
600 <varlistentry>
601 <term><option>-f</option></term>
602 <term><option>--follow</option></term>
603
604 <listitem><para>Show only the most recent journal entries, and continuously print new entries as
605 they are appended to the journal.</para></listitem>
606 </varlistentry>
607
608 <varlistentry>
609 <term><option>--no-tail</option></term>
610
611 <listitem><para>Show all stored output lines, even in follow mode. Undoes the effect of
612 <option>--lines=</option>.</para></listitem>
613 </varlistentry>
614
615 <varlistentry>
616 <term><option>-q</option></term>
617 <term><option>--quiet</option></term>
618
619 <listitem><para>Suppresses all informational messages (i.e. "-- Journal begins at …", "-- Reboot
620 --"), any warning messages regarding inaccessible system journals when run as a normal
621 user.</para></listitem>
622 </varlistentry>
623 </variablelist>
624 </refsect1>
625
626 <refsect1>
627 <title>Pager Control Options</title>
628
629 <para>The following options control page support:</para>
630
631 <variablelist>
632
633 <xi:include href="standard-options.xml" xpointer="no-pager" />
634
635 <varlistentry>
636 <term><option>-e</option></term>
637 <term><option>--pager-end</option></term>
638
639 <listitem><para>Immediately jump to the end of the journal inside the implied pager tool. This
640 implies <option>-n1000</option> to guarantee that the pager will not buffer logs of unbounded
641 size. This may be overridden with an explicit <option>-n</option> with some other numeric value,
642 while <option>-nall</option> will disable this cap. Note that this option is only supported for
643 the <citerefentry
644 project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>
645 pager.</para></listitem>
646 </varlistentry>
647 </variablelist>
648 </refsect1>
649
650 <refsect1>
651 <title>Forward Secure Sealing (FSS) Options</title>
652
653 <para>The following options make be used together with the <option>--setup-keys</option> command, see below.</para>
654
655 <variablelist>
656 <varlistentry>
657 <term><option>--interval=</option></term>
658
659 <listitem><para>Specifies the change interval for the sealing key when generating an FSS key pair
660 with <option>--setup-keys</option>. Shorter intervals increase CPU consumption but shorten the time
661 range of undetectable journal alterations. Defaults to 15min.</para></listitem>
662 </varlistentry>
663
664 <varlistentry>
665 <term><option>--verify-key=</option></term>
666
667 <listitem><para>Specifies the FSS verification key to use for the <option>--verify</option>
668 operation.</para></listitem>
669 </varlistentry>
670
671 <varlistentry>
672 <term><option>--force</option></term>
673
674 <listitem><para>When <option>--setup-keys</option> is passed and Forward Secure Sealing (FSS) has
675 already been configured, recreate FSS keys.</para></listitem>
676 </varlistentry>
677 </variablelist>
678 </refsect1>
679
680 <refsect1>
681 <title>Commands</title>
682
683 <para>The following commands are understood. If none is specified the default is to display journal records.</para>
684
685 <variablelist>
686 <varlistentry>
687 <term><option>-N</option></term>
688 <term><option>--fields</option></term>
689
690 <listitem><para>Print all field names currently used in all entries of the journal.</para></listitem>
691 </varlistentry>
692
693 <varlistentry>
694 <term><option>-F</option></term>
695 <term><option>--field=</option></term>
696
697 <listitem><para>Print all possible data values the specified field can take in all entries of the
698 journal.</para></listitem>
699 </varlistentry>
700
701 <varlistentry>
702 <term><option>--list-boots</option></term>
703
704 <listitem><para>Show a tabular list of boot numbers (relative to the current boot), their IDs, and
705 the timestamps of the first and last message pertaining to the boot.</para></listitem>
706 </varlistentry>
707
708 <varlistentry>
709 <term><option>--disk-usage</option></term>
710
711 <listitem><para>Shows the current disk usage of all journal files. This shows the sum of the disk
712 usage of all archived and active journal files.</para></listitem>
713 </varlistentry>
714
715 <varlistentry>
716 <term><option>--vacuum-size=</option></term>
717 <term><option>--vacuum-time=</option></term>
718 <term><option>--vacuum-files=</option></term>
719
720 <listitem><para>Removes the oldest archived journal files until the disk space they use falls below
721 the specified size (specified with the usual <literal>K</literal>, <literal>M</literal>,
722 <literal>G</literal> and <literal>T</literal> suffixes), or all archived journal files contain no
723 data older than the specified timespan (specified with the usual <literal>s</literal>,
724 <literal>m</literal>, <literal>h</literal>, <literal>days</literal>, <literal>months</literal>,
725 <literal>weeks</literal> and <literal>years</literal> suffixes), or no more than the specified
726 number of separate journal files remain. Note that running <option>--vacuum-size=</option> has only
727 an indirect effect on the output shown by <option>--disk-usage</option>, as the latter includes
728 active journal files, while the vacuuming operation only operates on archived journal
729 files. Similarly, <option>--vacuum-files=</option> might not actually reduce the number of journal
730 files to below the specified number, as it will not remove active journal files.</para>
731
732 <para><option>--vacuum-size=</option>, <option>--vacuum-time=</option> and
733 <option>--vacuum-files=</option> may be combined in a single invocation to enforce any combination
734 of a size, a time and a number of files limit on the archived journal files. Specifying any of
735 these three parameters as zero is equivalent to not enforcing the specific limit, and is thus
736 redundant.</para>
737
738 <para>These three switches may also be combined with <option>--rotate</option> into one command. If
739 so, all active files are rotated first, and the requested vacuuming operation is executed right
740 after. The rotation has the effect that all currently active files are archived (and potentially new,
741 empty journal files opened as replacement), and hence the vacuuming operation has the greatest effect
742 as it can take all log data written so far into account.</para></listitem>
743 </varlistentry>
744
745 <varlistentry>
746 <term><option>--verify</option></term>
747
748 <listitem><para>Check the journal file for internal consistency. If the file has been generated
749 with FSS enabled and the FSS verification key has been specified with
750 <option>--verify-key=</option>, authenticity of the journal file is verified.</para></listitem>
751 </varlistentry>
752
753 <varlistentry>
754 <term><option>--sync</option></term>
755
756 <listitem><para>Asks the journal daemon to write all yet unwritten journal data to the backing file
757 system and synchronize all journals. This call does not return until the synchronization operation
758 is complete. This command guarantees that any log messages written before its invocation are safely
759 stored on disk at the time it returns.</para></listitem>
760 </varlistentry>
761
762 <varlistentry>
763 <term><option>--relinquish-var</option></term>
764
765 <listitem><para>Asks the journal daemon for the reverse operation to <option>--flush</option>: if
766 requested the daemon will write further log data to <filename>/run/log/journal/</filename> and
767 stops writing to <filename>/var/log/journal/</filename>. A subsequent call to
768 <option>--flush</option> causes the log output to switch back to
769 <filename>/var/log/journal/</filename>, see above.</para></listitem>
770 </varlistentry>
771
772 <varlistentry>
773 <term><option>--smart-relinquish-var</option></term>
774
775 <listitem><para>Similar to <option>--relinquish-var</option>, but executes no operation if the root
776 file system and <filename>/var/lib/journal/</filename> reside on the same mount point. This operation
777 is used during system shutdown in order to make the journal daemon stop writing data to
778 <filename>/var/log/journal/</filename> in case that directory is located on a mount point that needs
779 to be unmounted.</para></listitem>
780 </varlistentry>
781
782 <varlistentry>
783 <term><option>--flush</option></term>
784
785 <listitem><para>Asks the journal daemon to flush any log data stored in
786 <filename>/run/log/journal/</filename> into <filename>/var/log/journal/</filename>, if persistent
787 storage is enabled. This call does not return until the operation is complete. Note that this call is
788 idempotent: the data is only flushed from <filename>/run/log/journal/</filename> into
789 <filename>/var/log/journal/</filename> once during system runtime (but see
790 <option>--relinquish-var</option> below), and this command exits cleanly without executing any
791 operation if this has already happened. This command effectively guarantees that all data is flushed
792 to <filename>/var/log/journal/</filename> at the time it returns.</para></listitem>
793 </varlistentry>
794
795 <varlistentry>
796 <term><option>--rotate</option></term>
797
798 <listitem><para>Asks the journal daemon to rotate journal files. This call does not return until
799 the rotation operation is complete. Journal file rotation has the effect that all currently active
800 journal files are marked as archived and renamed, so that they are never written to in future. New
801 (empty) journal files are then created in their place. This operation may be combined with
802 <option>--vacuum-size=</option>, <option>--vacuum-time=</option> and
803 <option>--vacuum-file=</option> into a single command, see above.</para></listitem>
804 </varlistentry>
805
806 <varlistentry>
807 <term><option>--header</option></term>
808
809 <listitem><para>Instead of showing journal contents, show internal header information of the
810 journal fields accessed.</para>
811
812 <para>This option is particularly useful when trying to identify out-of-order journal entries, as
813 happens for example when the machine is booted with the wrong system time.</para></listitem>
814 </varlistentry>
815
816 <varlistentry>
817 <term><option>--list-catalog <optional><replaceable>128-bit-ID…</replaceable></optional></option></term>
818
819 <listitem><para>List the contents of the message catalog as a table of message IDs, plus their
820 short description strings.</para>
821
822 <para>If any <replaceable>128-bit-ID</replaceable>s are specified, only those entries are
823 shown.</para></listitem>
824 </varlistentry>
825
826 <varlistentry>
827 <term><option>--dump-catalog <optional><replaceable>128-bit-ID…</replaceable></optional></option></term>
828
829 <listitem><para>Show the contents of the message catalog, with entries separated by a line
830 consisting of two dashes and the ID (the format is the same as <filename>.catalog</filename>
831 files).</para>
832
833 <para>If any <replaceable>128-bit-ID</replaceable>s are specified, only those entries are
834 shown.</para></listitem>
835 </varlistentry>
836
837 <varlistentry>
838 <term><option>--update-catalog</option></term>
839
840 <listitem><para>Update the message catalog index. This command needs to be executed each time new
841 catalog files are installed, removed, or updated to rebuild the binary catalog
842 index.</para></listitem>
843 </varlistentry>
844
845 <varlistentry>
846 <term><option>--setup-keys</option></term>
847
848 <listitem><para>Instead of showing journal contents, generate a new key pair for Forward Secure
849 Sealing (FSS). This will generate a sealing key and a verification key. The sealing key is stored in
850 the journal data directory and shall remain on the host. The verification key should be stored
851 externally. Refer to the <option>Seal=</option> option in
852 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
853 information on Forward Secure Sealing and for a link to a refereed scholarly paper detailing the
854 cryptographic theory it is based on.</para></listitem>
855 </varlistentry>
856
857 <xi:include href="standard-options.xml" xpointer="help" />
858 <xi:include href="standard-options.xml" xpointer="version" />
859 </variablelist>
860 </refsect1>
861
862 <refsect1>
863 <title>Exit status</title>
864
865 <para>On success, 0 is returned; otherwise, a non-zero failure code is returned.</para>
866 </refsect1>
867
868 <xi:include href="common-variables.xml" />
869
870 <refsect1>
871 <title>Examples</title>
872
873 <para>Without arguments, all collected logs are shown unfiltered:</para>
874
875 <programlisting>journalctl</programlisting>
876
877 <para>With one match specified, all entries with a field matching the expression are shown:</para>
878
879 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service
880 journalctl _SYSTEMD_CGROUP=/user.slice/user-42.slice/session-c1.scope</programlisting>
881
882 <para>If two different fields are matched, only entries matching both expressions at the same time are
883 shown:</para>
884
885 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
886
887 <para>If two matches refer to the same field, all entries matching either expression are shown:</para>
888
889 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
890
891 <para>If the separator <literal>+</literal> is used, two expressions may be combined in a logical OR. The
892 following will show all messages from the Avahi service process with the PID 28097 plus all messages from
893 the D-Bus service (from any of its processes):</para>
894
895 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
896
897 <para>To show all fields emitted <emphasis>by</emphasis> a unit and <emphasis>about</emphasis> the unit,
898 option <option>-u</option>/<option>--unit=</option> should be used. <command>journalctl -u
899 <replaceable>name</replaceable></command> expands to a complex filter similar to
900
901 <programlisting>_SYSTEMD_UNIT=<replaceable>name</replaceable>.service
902 + UNIT=<replaceable>name</replaceable>.service _PID=1
903 + OBJECT_SYSTEMD_UNIT=<replaceable>name</replaceable>.service _UID=0
904 + COREDUMP_UNIT=<replaceable>name</replaceable>.service _UID=0 MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1</programlisting>
905
906 (see
907 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
908 for an explanation of those patterns).</para>
909
910 <para>Show all logs generated by the D-Bus executable:</para>
911
912 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
913
914 <para>Show all kernel logs from previous boot:</para>
915
916 <programlisting>journalctl -k -b -1</programlisting>
917
918 <para>Show a live log display from a system service <filename>apache.service</filename>:</para>
919
920 <programlisting>journalctl -f -u apache</programlisting>
921 </refsect1>
922
923 <refsect1>
924 <title>See Also</title>
925 <para>
926 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
927 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
928 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
929 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
930 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
931 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
932 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
933 <citerefentry><refentrytitle>systemd-journal-remote.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
934 <citerefentry><refentrytitle>systemd-journal-upload.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
935 </para>
936 </refsect1>
937 </refentry>