]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.journal-fields.xml
man: fix journalctl --new-id128 option name (#5786)
[thirdparty/systemd.git] / man / systemd.journal-fields.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 2010 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="systemd.journal-fields">
25
26 <refentryinfo>
27 <title>systemd.journal-fields</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>systemd.journal-fields</refentrytitle>
42 <manvolnum>7</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd.journal-fields</refname>
47 <refpurpose>Special journal fields</refpurpose>
48 </refnamediv>
49
50 <refsect1>
51 <title>Description</title>
52
53 <para>Entries in the journal resemble an environment block in
54 their syntax but with fields that can include binary data.
55 Primarily, fields are formatted UTF-8 text strings, and binary
56 formatting is used only where formatting as UTF-8 text strings
57 makes little sense. New fields may freely be defined by
58 applications, but a few fields have special meaning. All fields
59 with special meanings are optional. In some cases, fields may
60 appear more than once per entry.</para>
61 </refsect1>
62
63 <refsect1>
64 <title>User Journal Fields</title>
65
66 <para>User fields are fields that are directly passed from clients
67 and stored in the journal.</para>
68
69 <variablelist class='journal-directives'>
70 <varlistentry>
71 <term><varname>MESSAGE=</varname></term>
72 <listitem>
73 <para>The human-readable message string for this entry. This
74 is supposed to be the primary text shown to the user. It is
75 usually not translated (but might be in some cases), and is
76 not supposed to be parsed for metadata.</para>
77 </listitem>
78 </varlistentry>
79
80 <varlistentry>
81 <term><varname>MESSAGE_ID=</varname></term>
82 <listitem>
83 <para>A 128-bit message identifier ID for recognizing
84 certain message types, if this is desirable. This should
85 contain a 128-bit ID formatted as a lower-case hexadecimal
86 string, without any separating dashes or suchlike. This is
87 recommended to be a UUID-compatible ID, but this is not
88 enforced, and formatted differently. Developers can generate
89 a new ID for this purpose with <command>journalctl
90 <option>--new-id128</option></command>.
91 </para>
92 </listitem>
93 </varlistentry>
94
95 <varlistentry>
96 <term><varname>PRIORITY=</varname></term>
97 <listitem>
98 <para>A priority value between 0 (<literal>emerg</literal>)
99 and 7 (<literal>debug</literal>) formatted as a decimal
100 string. This field is compatible with syslog's priority
101 concept.</para>
102 </listitem>
103 </varlistentry>
104
105 <varlistentry>
106 <term><varname>CODE_FILE=</varname></term>
107 <term><varname>CODE_LINE=</varname></term>
108 <term><varname>CODE_FUNC=</varname></term>
109 <listitem>
110 <para>The code location generating this message, if known.
111 Contains the source filename, the line number and the
112 function name.</para>
113 </listitem>
114 </varlistentry>
115
116 <varlistentry>
117 <term><varname>ERRNO=</varname></term>
118 <listitem>
119 <para>The low-level Unix error number causing this entry, if
120 any. Contains the numeric value of
121 <citerefentry project='man-pages'><refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum></citerefentry>
122 formatted as a decimal string.</para>
123 </listitem>
124 </varlistentry>
125
126 <varlistentry>
127 <term><varname>SYSLOG_FACILITY=</varname></term>
128 <term><varname>SYSLOG_IDENTIFIER=</varname></term>
129 <term><varname>SYSLOG_PID=</varname></term>
130 <listitem>
131 <para>Syslog compatibility fields containing the facility
132 (formatted as decimal string), the identifier string (i.e.
133 "tag"), and the client PID. (Note that the tag is usually
134 derived from glibc's
135 <varname>program_invocation_short_name</varname> variable,
136 see
137 <citerefentry project='die-net'><refentrytitle>program_invocation_short_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>.)</para>
138 </listitem>
139
140 </varlistentry>
141 </variablelist>
142 </refsect1>
143
144 <refsect1>
145 <title>Trusted Journal Fields</title>
146
147 <para>Fields prefixed with an underscore are trusted fields, i.e.
148 fields that are implicitly added by the journal and cannot be
149 altered by client code.</para>
150
151 <variablelist class='journal-directives'>
152 <varlistentry>
153 <term><varname>_PID=</varname></term>
154 <term><varname>_UID=</varname></term>
155 <term><varname>_GID=</varname></term>
156 <listitem>
157 <para>The process, user, and group ID of the process the
158 journal entry originates from formatted as a decimal
159 string.</para>
160 </listitem>
161 </varlistentry>
162
163 <varlistentry>
164 <term><varname>_COMM=</varname></term>
165 <term><varname>_EXE=</varname></term>
166 <term><varname>_CMDLINE=</varname></term>
167 <listitem>
168 <para>The name, the executable path, and the command line of
169 the process the journal entry originates from.</para>
170 </listitem>
171 </varlistentry>
172
173 <varlistentry>
174 <term><varname>_CAP_EFFECTIVE=</varname></term>
175 <listitem>
176 <para>The effective
177 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
178 of the process the journal entry originates from.</para>
179 </listitem>
180 </varlistentry>
181
182 <varlistentry>
183 <term><varname>_AUDIT_SESSION=</varname></term>
184 <term><varname>_AUDIT_LOGINUID=</varname></term>
185 <listitem>
186 <para>The session and login UID of the process the journal
187 entry originates from, as maintained by the kernel audit
188 subsystem.</para>
189 </listitem>
190 </varlistentry>
191
192 <varlistentry>
193 <term><varname>_SYSTEMD_CGROUP=</varname></term>
194 <term><varname>_SYSTEMD_SESSION=</varname></term>
195 <term><varname>_SYSTEMD_UNIT=</varname></term>
196 <term><varname>_SYSTEMD_USER_UNIT=</varname></term>
197 <term><varname>_SYSTEMD_OWNER_UID=</varname></term>
198 <term><varname>_SYSTEMD_SLICE=</varname></term>
199
200 <listitem>
201 <para>The control group path in the systemd hierarchy, the
202 systemd session ID (if any), the systemd unit name (if any),
203 the systemd user session unit name (if any), the owner UID
204 of the systemd session (if any) and the systemd slice unit
205 of the process the journal entry originates from.</para>
206 </listitem>
207 </varlistentry>
208
209 <varlistentry>
210 <term><varname>_SELINUX_CONTEXT=</varname></term>
211 <listitem>
212 <para>The SELinux security context (label) of the process
213 the journal entry originates from.</para>
214 </listitem>
215 </varlistentry>
216
217 <varlistentry>
218 <term><varname>_SOURCE_REALTIME_TIMESTAMP=</varname></term>
219 <listitem>
220 <para>The earliest trusted timestamp of the message, if any
221 is known that is different from the reception time of the
222 journal. This is the time in microseconds since the epoch
223 UTC, formatted as a decimal string.</para>
224 </listitem>
225 </varlistentry>
226
227 <varlistentry>
228 <term><varname>_BOOT_ID=</varname></term>
229 <listitem>
230 <para>The kernel boot ID for the boot the message was
231 generated in, formatted as a 128-bit hexadecimal
232 string.</para>
233 </listitem>
234 </varlistentry>
235
236 <varlistentry>
237 <term><varname>_MACHINE_ID=</varname></term>
238 <listitem>
239 <para>The machine ID of the originating host, as available
240 in
241 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
242 </listitem>
243 </varlistentry>
244
245 <varlistentry>
246 <term><varname>_SYSTEMD_INVOCATION_ID=</varname></term>
247 <listitem>
248 <para>The invocation ID for the runtime cycle of the unit
249 the message was generated in, as available to processes
250 of the unit in <varname>$INVOCATION_ID</varname> (see
251 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>).</para>
252 </listitem>
253 </varlistentry>
254
255 <varlistentry>
256 <term><varname>_HOSTNAME=</varname></term>
257 <listitem>
258 <para>The name of the originating host.</para>
259 </listitem>
260 </varlistentry>
261
262 <varlistentry>
263 <term><varname>_TRANSPORT=</varname></term>
264 <listitem>
265 <para>How the entry was received by the journal service.
266 Valid transports are:
267 </para>
268 <variablelist>
269 <varlistentry>
270 <term>
271 <option>audit</option>
272 </term>
273 <listitem>
274 <para>for those read from the kernel audit subsystem
275 </para>
276 </listitem>
277 </varlistentry>
278
279 <varlistentry>
280 <term>
281 <option>driver</option>
282 </term>
283 <listitem>
284 <para>for internally generated messages
285 </para>
286 </listitem>
287 </varlistentry>
288
289 <varlistentry>
290 <term>
291 <option>syslog</option>
292 </term>
293 <listitem>
294 <para>for those received via the local syslog socket
295 with the syslog protocol
296 </para>
297 </listitem>
298 </varlistentry>
299
300 <varlistentry>
301 <term>
302 <option>journal</option>
303 </term>
304 <listitem>
305 <para>for those received via the native journal
306 protocol
307 </para>
308 </listitem>
309 </varlistentry>
310
311 <varlistentry>
312 <term>
313 <option>stdout</option>
314 </term>
315 <listitem>
316 <para>for those read from a service's standard output
317 or error output
318 </para>
319 </listitem>
320 </varlistentry>
321
322 <varlistentry>
323 <term>
324 <option>kernel</option>
325 </term>
326 <listitem>
327 <para>for those read from the kernel
328 </para>
329 </listitem>
330 </varlistentry>
331 </variablelist>
332 </listitem>
333 </varlistentry>
334 </variablelist>
335 </refsect1>
336
337 <refsect1>
338 <title>Kernel Journal Fields</title>
339
340 <para>Kernel fields are fields that are used by messages
341 originating in the kernel and stored in the journal.</para>
342
343 <variablelist class='journal-directives'>
344 <varlistentry>
345 <term><varname>_KERNEL_DEVICE=</varname></term>
346 <listitem>
347 <para>The kernel device name. If the entry is associated to
348 a block device, the major and minor of the device node,
349 separated by <literal>:</literal> and prefixed by
350 <literal>b</literal>. Similar for character devices but
351 prefixed by <literal>c</literal>. For network devices, this
352 is the interface index prefixed by <literal>n</literal>. For
353 all other devices, this is the subsystem name prefixed by
354 <literal>+</literal>, followed by <literal>:</literal>,
355 followed by the kernel device name.</para>
356 </listitem>
357 </varlistentry>
358 <varlistentry>
359 <term><varname>_KERNEL_SUBSYSTEM=</varname></term>
360 <listitem>
361 <para>The kernel subsystem name.</para>
362 </listitem>
363 </varlistentry>
364 <varlistentry>
365 <term><varname>_UDEV_SYSNAME=</varname></term>
366 <listitem>
367 <para>The kernel device name as it shows up in the device
368 tree below <filename>/sys</filename>.</para>
369 </listitem>
370 </varlistentry>
371 <varlistentry>
372 <term><varname>_UDEV_DEVNODE=</varname></term>
373 <listitem>
374 <para>The device node path of this device in
375 <filename>/dev</filename>.</para>
376 </listitem>
377 </varlistentry>
378 <varlistentry>
379 <term><varname>_UDEV_DEVLINK=</varname></term>
380 <listitem>
381 <para>Additional symlink names pointing to the device node
382 in <filename>/dev</filename>. This field is frequently set
383 more than once per entry.</para>
384 </listitem>
385 </varlistentry>
386 </variablelist>
387 </refsect1>
388
389 <refsect1>
390 <title>Fields to log on behalf of a different program</title>
391
392 <para>Fields in this section are used by programs to specify that
393 they are logging on behalf of another program or unit.
394 </para>
395
396 <para>Fields used by the <command>systemd-coredump</command>
397 coredump kernel helper:
398 </para>
399
400 <variablelist class='journal-directives'>
401 <varlistentry>
402 <term><varname>COREDUMP_UNIT=</varname></term>
403 <term><varname>COREDUMP_USER_UNIT=</varname></term>
404 <listitem>
405 <para>Used to annotate messages containing coredumps from
406 system and session units. See
407 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
408 </para>
409 </listitem>
410 </varlistentry>
411 </variablelist>
412
413 <para>Privileged programs (currently UID 0) may attach
414 <varname>OBJECT_PID=</varname> to a message. This will instruct
415 <command>systemd-journald</command> to attach additional fields on
416 behalf of the caller:</para>
417
418 <variablelist class='journal-directives'>
419 <varlistentry>
420 <term><varname>OBJECT_PID=<replaceable>PID</replaceable></varname></term>
421 <listitem>
422 <para>PID of the program that this message pertains to.
423 </para>
424 </listitem>
425 </varlistentry>
426
427 <varlistentry>
428 <term><varname>OBJECT_UID=</varname></term>
429 <term><varname>OBJECT_GID=</varname></term>
430 <term><varname>OBJECT_COMM=</varname></term>
431 <term><varname>OBJECT_EXE=</varname></term>
432 <term><varname>OBJECT_CMDLINE=</varname></term>
433 <term><varname>OBJECT_AUDIT_SESSION=</varname></term>
434 <term><varname>OBJECT_AUDIT_LOGINUID=</varname></term>
435 <term><varname>OBJECT_SYSTEMD_CGROUP=</varname></term>
436 <term><varname>OBJECT_SYSTEMD_SESSION=</varname></term>
437 <term><varname>OBJECT_SYSTEMD_OWNER_UID=</varname></term>
438 <term><varname>OBJECT_SYSTEMD_UNIT=</varname></term>
439 <term><varname>OBJECT_SYSTEMD_USER_UNIT=</varname></term>
440 <listitem>
441 <para>These are additional fields added automatically by
442 <command>systemd-journald</command>. Their meaning is the
443 same as
444 <varname>_UID=</varname>,
445 <varname>_GID=</varname>,
446 <varname>_COMM=</varname>,
447 <varname>_EXE=</varname>,
448 <varname>_CMDLINE=</varname>,
449 <varname>_AUDIT_SESSION=</varname>,
450 <varname>_AUDIT_LOGINUID=</varname>,
451 <varname>_SYSTEMD_CGROUP=</varname>,
452 <varname>_SYSTEMD_SESSION=</varname>,
453 <varname>_SYSTEMD_UNIT=</varname>,
454 <varname>_SYSTEMD_USER_UNIT=</varname>, and
455 <varname>_SYSTEMD_OWNER_UID=</varname>
456 as described above, except that the process identified by
457 <replaceable>PID</replaceable> is described, instead of the
458 process which logged the message.</para>
459 </listitem>
460 </varlistentry>
461 </variablelist>
462
463 </refsect1>
464
465 <refsect1>
466 <title>Address Fields</title>
467
468 <para>During serialization into external formats, such as the
469 <ulink
470 url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal
471 Export Format</ulink> or the <ulink
472 url="https://www.freedesktop.org/wiki/Software/systemd/json">Journal
473 JSON Format</ulink>, the addresses of journal entries are
474 serialized into fields prefixed with double underscores. Note that
475 these are not proper fields when stored in the journal but for
476 addressing metadata of entries. They cannot be written as part of
477 structured log entries via calls such as
478 <citerefentry><refentrytitle>sd_journal_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
479 They may also not be used as matches for
480 <citerefentry><refentrytitle>sd_journal_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry></para>
481
482 <variablelist class='journal-directives'>
483 <varlistentry>
484 <term><varname>__CURSOR=</varname></term>
485 <listitem>
486 <para>The cursor for the entry. A cursor is an opaque text
487 string that uniquely describes the position of an entry in
488 the journal and is portable across machines, platforms and
489 journal files.
490 </para>
491 </listitem>
492 </varlistentry>
493
494 <varlistentry>
495 <term><varname>__REALTIME_TIMESTAMP=</varname></term>
496 <listitem>
497 <para>The wallclock time
498 (<constant>CLOCK_REALTIME</constant>) at the point in time
499 the entry was received by the journal, in microseconds since
500 the epoch UTC, formatted as a decimal string. This has
501 different properties from
502 <literal>_SOURCE_REALTIME_TIMESTAMP=</literal>, as it is
503 usually a bit later but more likely to be monotonic.
504 </para>
505 </listitem>
506 </varlistentry>
507
508 <varlistentry>
509 <term><varname>__MONOTONIC_TIMESTAMP=</varname></term>
510 <listitem>
511 <para>The monotonic time
512 (<constant>CLOCK_MONOTONIC</constant>) at the point in time
513 the entry was received by the journal in microseconds,
514 formatted as a decimal string. To be useful as an address
515 for the entry, this should be combined with the boot ID in
516 <literal>_BOOT_ID=</literal>.
517 </para>
518 </listitem>
519 </varlistentry>
520 </variablelist>
521 </refsect1>
522
523 <refsect1>
524 <title>See Also</title>
525 <para>
526 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
527 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
528 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
529 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
530 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
531 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
532 </para>
533 </refsect1>
534
535 </refentry>