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