]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/journalctl.xml
nspawn: handle poweroff/reboot nicely in containers
[thirdparty/systemd.git] / man / journalctl.xml
CommitLineData
2af777ba
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5<!--
6 This file is part of systemd.
7
8 Copyright 2012 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
2af777ba
LP
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 18 Lesser General Public License for more details.
2af777ba 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
2af777ba
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
169c4f65 24<refentry id="journalctl">
2af777ba
LP
25
26 <refentryinfo>
169c4f65 27 <title>journalctl</title>
2af777ba
LP
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
169c4f65 41 <refentrytitle>journalctl</refentrytitle>
2af777ba
LP
42 <manvolnum>1</manvolnum>
43 </refmeta>
44
45 <refnamediv>
169c4f65 46 <refname>journalctl</refname>
2af777ba
LP
47 <refpurpose>Query the systemd journal</refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <cmdsynopsis>
cbdca852 52 <command>journalctl <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt" rep="repeat">MATCHES</arg></command>
2af777ba
LP
53 </cmdsynopsis>
54 </refsynopsisdiv>
55
56 <refsect1>
57 <title>Description</title>
58
01cf0ca8
LP
59 <para><command>journalctl</command> may be used to
60 query the contents of the
2af777ba 61 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
01cf0ca8
LP
62 journal as written by
63 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
2af777ba
LP
64
65 <para>If called without parameter will show the full
66 contents of the journal, starting with the oldest
67 entry collected.</para>
68
cbdca852
LP
69 <para>If one or more match arguments are passed the
70 output is filtered accordingly. A match is in the
71 format <literal>FIELD=VALUE</literal>,
72 e.g. <literal>_SYSTEMD_UNIT=httpd.service</literal>,
73 referring to the components of a structured journal
74 entry. See
ffa16db0 75 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
cbdca852
LP
76 for a list of well-known fields. If multiple matches
77 are specified matching different fields the log
78 entries are filtered by both, i.e. the resulting output
79 will show only entries matching all the specified
80 matches of this kind. If two matches apply to the same
81 field, then they are automatically matched as
82 alternatives, i.e. the resulting output will show
83 entries matching any of the specified matches for the
84 same field. Finally, if the character
85 "<literal>+</literal>" appears as separate word on the
86 command line all matches before and after are combined
87 in a disjunction (i.e. logical OR).</para>
2af777ba 88
b6a34514
LP
89 <para>As shortcuts for a few types of field/value
90 matches file paths may be specified. If a file path
91 refers to an executable file, this is equivalent to an
92 <literal>_EXE=</literal> match for the canonicalized
93 binary path. Similar, if a path refers to a device
94 node, this is equivalent to a
95 <literal>_KERNEL_DEVICE=</literal> match for the
96 device.</para>
97
2af777ba
LP
98 <para>Output is interleaved from all accessible
99 journal files, whether they are rotated or currently
100 being written, and regardless whether they belong to the
101 system itself or are accessible user journals.</para>
102
103 <para>All users are granted access to their private
104 per-user journals. However, by default only root and
105 users who are members of the <literal>adm</literal>
106 group get access to the system journal and the
107 journals of other users.</para>
108 </refsect1>
109
110 <refsect1>
111 <title>Options</title>
112
113 <para>The following options are understood:</para>
114
115 <variablelist>
116 <varlistentry>
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
0e25e94e
KS
134 <listitem><para>Do not pipe output into a
135 pager.</para></listitem>
136 </varlistentry>
2af777ba
LP
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 most recent
49f43d5f 153 journal entries, and continuously print
5c3246b1
LP
154 new entries as they are appended to
155 the journal.</para></listitem>
2af777ba
LP
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. Takes a positive
165 integer argument. In follow mode
166 defaults to 10, otherwise is unset
167 thus not limiting how many lines are
168 shown.</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
f8813ec7
LP
185 formatting of the journal entries that
186 are shown. Takes one of
2af777ba
LP
187 <literal>short</literal>,
188 <literal>short-monotonic</literal>,
189 <literal>verbose</literal>,
190 <literal>export</literal>,
191 <literal>json</literal>,
a6e87e90 192 <literal>json-pretty</literal>,
2af777ba
LP
193 <literal>cat</literal>. <literal>short</literal>
194 is the default and generates an output
195 that is mostly identical to the
196 formatting of classic syslog log
197 files, showing one line per journal
198 entry. <literal>short-monotonic</literal>
199 is very similar but shows monotonic
200 timestamps instead of wallclock
201 timestamps. <literal>verbose</literal>
49f43d5f 202 shows the full structured entry items
2af777ba 203 with all
49f43d5f 204 fields. <literal>export</literal>
2af777ba
LP
205 serializes the journal into a binary
206 (but mostly text-based) stream
207 suitable for backups and network
f8813ec7
LP
208 transfer (see <ulink
209 url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
210 Export Format</ulink> for more
211 information). <literal>json</literal>
2af777ba 212 formats entries as JSON data
a6e87e90
LP
213 structures, one per
214 line. <literal>json-pretty</literal>
215 also formats entries as JSON data
216 structures, but formats them in
217 multiple lines in order to make them
218 more readable for
219 humans. <literal>cat</literal>
2af777ba
LP
220 generates a very terse output only
221 showing the actual message of each
222 journal entry with no meta data, not
223 even a timestamp.</para></listitem>
224 </varlistentry>
225
226 <varlistentry>
227 <term><option>--quiet</option></term>
228 <term><option>-q</option></term>
229
230 <listitem><para>Suppresses any warning
49f43d5f 231 message regarding inaccessible system
2af777ba
LP
232 journals when run as normal
233 user.</para></listitem>
234 </varlistentry>
235
2bd3c38a
LP
236 <varlistentry>
237 <term><option>--local</option></term>
238 <term><option>-l</option></term>
239
240 <listitem><para>Show only locally
241 generated messages.</para></listitem>
242 </varlistentry>
243
59cea26a
LP
244 <varlistentry>
245 <term><option>--this-boot</option></term>
246 <term><option>-b</option></term>
247
248 <listitem><para>Show data only from
931974af 249 current boot.</para></listitem>
59cea26a
LP
250 </varlistentry>
251
a963990f
LP
252 <varlistentry>
253 <term><option>--directory=</option></term>
254 <term><option>-D</option></term>
255
256 <listitem><para>Takes an absolute
257 directory path as argument. If
14a65d65 258 specified will operate on the
a963990f
LP
259 specified journal directory instead of
260 the default runtime and system journal
261 paths.</para></listitem>
262 </varlistentry>
263
941e990d
LP
264 <varlistentry>
265 <term><option>-p</option></term>
266 <term><option>--priority=</option></term>
267
268 <listitem><para>Filter output by
269 message priorities or priority
270 ranges. Takes either a single numeric
271 or textual log level (i.e. between
272 0/<literal>emerg</literal> and
273 7/<literal>debug</literal>), or a
274 range of numeric/text log levels in
275 the form FROM..TO. The log levels are
276 the usual syslog log levels as
277 documented in
278 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
279 i.e. <literal>emerg</literal> (0),
280 <literal>alert</literal> (1),
281 <literal>crit</literal> (2),
282 <literal>err</literal> (3),
283 <literal>warning</literal> (4),
284 <literal>notice</literal> (5),
285 <literal>info</literal> (6),
286 <literal>debug</literal> (7). If a
287 single log level is specified all
288 messages with this log levels or a
289 lower (hence more important) log level
290 are shown. If a range is specified all
291 messages within the range are shown,
292 including both the start and the end
293 value of the range.</para></listitem>
294 </varlistentry>
295
31094aae
LP
296 <varlistentry>
297 <term><option>--new-id128</option></term>
298
299 <listitem><para>Instead of showing
300 journal contents generate a new 128
301 bit ID suitable for identifying
302 messages. This is intended for usage
303 by developers who need a new
304 identifier for a new message they
305 introduce and want to make
306 recognizable. Will print the new ID in
307 three different formats which can be
308 copied into source code or
309 similar.</para></listitem>
310 </varlistentry>
311
312 <varlistentry>
313 <term><option>--header</option></term>
314
315 <listitem><para>Instead of showing
316 journal contents show internal header
317 information of the journal fiels
318 accessed.</para></listitem>
319 </varlistentry>
320
321 <varlistentry>
322 <term><option>--setup-keys</option></term>
323
324 <listitem><para>Instead of showing
325 journal contents generate a new key
326 pair for Forward Secure Sealing
327 (FSS). This will generate a sealing
328 key and a verification key. The
329 sealing key is stored in the journal
330 data directory and shall remain on the
331 host. The verification key should be
332 stored externally.</para></listitem>
333 </varlistentry>
334
335 <varlistentry>
336 <term><option>--interval=</option></term>
337
338 <listitem><para>Specifies the change
339 interval for the sealing key, when
340 generating an FSS key pair with
341 <option>--setup-keys</option>. Shorter
342 intervals increase CPU consumption but
343 shorten the time range of
344 undetectable journal
345 alterations. Defaults to
346 15min.</para></listitem>
347 </varlistentry>
348
349 <varlistentry>
350 <term><option>--verify</option></term>
351
352 <listitem><para>Check the journal file
353 for internal consistency. If the
354 file has been generated with FSS
355 enabled, and the FSS verification key
356 has been specified with
357 <option>--verify-key=</option>
358 authenticity of the journal file is
359 verified.</para></listitem>
360 </varlistentry>
361
362 <varlistentry>
363 <term><option>--verify-key=</option></term>
364
365 <listitem><para>Specifies the FSS
366 verification key to use for the
367 <option>--verify</option>
368 operation.</para></listitem>
369 </varlistentry>
370
2af777ba
LP
371 </variablelist>
372 </refsect1>
373
374 <refsect1>
375 <title>Exit status</title>
376
377 <para>On success 0 is returned, a non-zero failure
378 code otherwise.</para>
379 </refsect1>
380
381 <refsect1>
382 <title>Environment</title>
383
384 <variablelist>
385 <varlistentry>
386 <term><varname>$SYSTEMD_PAGER</varname></term>
387 <listitem><para>Pager to use when
388 <option>--no-pager</option> is not given;
389 overrides <varname>$PAGER</varname>. Setting
390 this to an empty string or the value
391 <literal>cat</literal> is equivalent to passing
392 <option>--no-pager</option>.</para></listitem>
393 </varlistentry>
394 </variablelist>
395 </refsect1>
396
cbdca852
LP
397 <refsect1>
398 <title>Examples</title>
399
400 <para>Without arguments all collected logs are shown
401 unfiltered:</para>
402
403 <programlisting>journalctl</programlisting>
404
405 <para>With one match specified all entries with a field matching the expression are shown:</para>
406
407 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service</programlisting>
408
409 <para>If two different fields are matched only entries matching both expressions at the same time are shown:</para>
410
411 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097</programlisting>
412
413 <para>If two matches refer to the same field all entries matching either expression are shown:</para>
414
415 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service</programlisting>
416
417 <para>If the separator "<literal>+</literal>" is used
418 two expression may be combined in a logical OR. The
419 following will show all messages from the Avahi
420 service process with the PID 28097 plus all messages
421 from the D-Bus service (from any of its
422 processes):</para>
423
424 <programlisting>journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service</programlisting>
425
b6a34514
LP
426 <para>Show all logs generated by the D-Bus executable:</para>
427
428 <programlisting>journalctl /usr/bin/dbus-daemon</programlisting>
429
430 <para>Show all logs of the kernel device node <filename>/dev/sda</filename>:</para>
431
432 <programlisting>journalctl /dev/sda</programlisting>
433
cbdca852
LP
434 </refsect1>
435
2af777ba
LP
436 <refsect1>
437 <title>See Also</title>
438 <para>
439 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
01cf0ca8 440 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
2af777ba 441 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
ffa16db0 442 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
18b754d3 443 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
2af777ba
LP
444 </para>
445 </refsect1>
446
447</refentry>