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