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