]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.journal-fields.xml
Merge pull request #24370 from keszybz/sysusers-equivs
[thirdparty/systemd.git] / man / systemd.journal-fields.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd.journal-fields">
7
8 <refentryinfo>
9 <title>systemd.journal-fields</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>systemd.journal-fields</refentrytitle>
15 <manvolnum>7</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>systemd.journal-fields</refname>
20 <refpurpose>Special journal fields</refpurpose>
21 </refnamediv>
22
23 <refsect1>
24 <title>Description</title>
25
26 <para>Entries in the journal (as written by
27 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
28 resemble a UNIX process environment block in syntax but with fields that may include binary data.
29 Primarily, fields are formatted UTF-8 text strings, and binary encoding is used only where formatting as
30 UTF-8 text strings makes little sense. New fields may freely be defined by applications, but a few fields
31 have special meanings. All fields with special meanings are optional. In some cases, fields may appear
32 more than once per entry.</para>
33 </refsect1>
34
35 <refsect1>
36 <title>User Journal Fields</title>
37
38 <para>User fields are fields that are directly passed from clients
39 and stored in the journal.</para>
40
41 <variablelist class='journal-directives'>
42 <varlistentry>
43 <term><varname>MESSAGE=</varname></term>
44 <listitem>
45 <para>The human-readable message string for this entry. This
46 is supposed to be the primary text shown to the user. It is
47 usually not translated (but might be in some cases), and is
48 not supposed to be parsed for metadata.</para>
49 </listitem>
50 </varlistentry>
51
52 <varlistentry>
53 <term><varname>MESSAGE_ID=</varname></term>
54 <listitem>
55 <para>A 128-bit message identifier ID for recognizing certain message types, if this is desirable. This
56 should contain a 128-bit ID formatted as a lower-case hexadecimal string, without any separating dashes or
57 suchlike. This is recommended to be a UUID-compatible ID, but this is not enforced, and formatted
58 differently. Developers can generate a new ID for this purpose with <command>systemd-id128 new</command>.
59 </para>
60 </listitem>
61 </varlistentry>
62
63 <varlistentry>
64 <term><varname>PRIORITY=</varname></term>
65 <listitem>
66 <para>A priority value between 0 (<literal>emerg</literal>)
67 and 7 (<literal>debug</literal>) formatted as a decimal
68 string. This field is compatible with syslog's priority
69 concept.</para>
70 </listitem>
71 </varlistentry>
72
73 <varlistentry>
74 <term><varname>CODE_FILE=</varname></term>
75 <term><varname>CODE_LINE=</varname></term>
76 <term><varname>CODE_FUNC=</varname></term>
77 <listitem>
78 <para>The code location generating this message, if known.
79 Contains the source filename, the line number and the
80 function name.</para>
81 </listitem>
82 </varlistentry>
83
84 <varlistentry>
85 <term><varname>ERRNO=</varname></term>
86 <listitem>
87 <para>The low-level Unix error number causing this entry, if
88 any. Contains the numeric value of
89 <citerefentry project='man-pages'><refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum></citerefentry>
90 formatted as a decimal string.</para>
91 </listitem>
92 </varlistentry>
93
94 <varlistentry>
95 <term><varname>INVOCATION_ID=</varname></term>
96 <term><varname>USER_INVOCATION_ID=</varname></term>
97 <listitem>
98 <para>A randomized, unique 128-bit ID identifying each runtime cycle of the unit. This is different from
99 <varname>_SYSTEMD_INVOCATION_ID</varname> in that it is only used for messages coming from systemd code
100 (e.g. logs from the system/user manager or from forked processes performing systemd-related setup).</para>
101 </listitem>
102 </varlistentry>
103
104 <varlistentry>
105 <term><varname>SYSLOG_FACILITY=</varname></term>
106 <term><varname>SYSLOG_IDENTIFIER=</varname></term>
107 <term><varname>SYSLOG_PID=</varname></term>
108 <term><varname>SYSLOG_TIMESTAMP=</varname></term>
109 <listitem>
110 <para>Syslog compatibility fields containing the facility (formatted as
111 decimal string), the identifier string (i.e. "tag"), the client PID, and
112 the timestamp as specified in the original datagram. (Note that the tag is
113 usually derived from glibc's
114 <varname>program_invocation_short_name</varname> variable, see
115 <citerefentry project='die-net'><refentrytitle>program_invocation_short_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>.)</para>
116 <para>Note that the journal service does not validate the values of any structured
117 journal fields whose name is not prefixed with an underscore, and this includes any
118 syslog related fields such as these. Hence, applications that supply a facility, PID,
119 or log level are expected to do so properly formatted, i.e. as numeric integers formatted
120 as decimal strings.</para>
121 </listitem>
122 </varlistentry>
123
124 <varlistentry>
125 <term><varname>SYSLOG_RAW=</varname></term>
126 <listitem>
127 <para>The original contents of the syslog line as received in the syslog
128 datagram. This field is only included if the <varname>MESSAGE=</varname>
129 field was modified compared to the original payload or the timestamp could
130 not be located properly and is not included in
131 <varname>SYSLOG_TIMESTAMP=</varname>. Message truncation occurs when
132 the message contains leading or trailing whitespace (trailing and leading
133 whitespace is stripped), or it contains an embedded
134 <constant>NUL</constant> byte (the <constant>NUL</constant> byte and
135 anything after it is not included). Thus, the original syslog line is
136 either stored as <varname>SYSLOG_RAW=</varname> or it can be recreated
137 based on the stored priority and facility, timestamp, identifier, and the
138 message payload in <varname>MESSAGE=</varname>.
139 </para>
140 </listitem>
141 </varlistentry>
142
143 <varlistentry>
144 <term><varname>DOCUMENTATION=</varname></term>
145 <listitem>
146 <para>A documentation URL with further information about the topic of the log message. Tools such
147 as <command>journalctl</command> will include a hyperlink to an URL specified this way in their
148 output. Should be an <literal>http://</literal>, <literal>https://</literal>,
149 <literal>file:/</literal>, <literal>man:</literal> or <literal>info:</literal> URL.</para>
150 </listitem>
151 </varlistentry>
152
153 <varlistentry>
154 <term><varname>TID=</varname></term>
155 <listitem>
156 <para>The numeric thread ID (TID) the log message originates from.</para>
157 </listitem>
158 </varlistentry>
159
160 <varlistentry>
161 <term><varname>UNIT=</varname></term>
162 <term><varname>USER_UNIT=</varname></term>
163 <listitem>
164 <para>The name of a unit. Used by the system and user managers when logging about specific
165 units.</para>
166
167 <para>When <option>--unit=<replaceable>name</replaceable></option> or
168 <option>--user-unit=<replaceable>name</replaceable></option> are used with
169 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, a
170 match pattern that includes <literal>UNIT=<replaceable>name</replaceable>.service</literal> or
171 <literal>USER_UNIT=<replaceable>name</replaceable>.service</literal> will be generated.</para>
172 </listitem>
173 </varlistentry>
174 </variablelist>
175 </refsect1>
176
177 <refsect1>
178 <title>Trusted Journal Fields</title>
179
180 <para>Fields prefixed with an underscore are trusted fields, i.e.
181 fields that are implicitly added by the journal and cannot be
182 altered by client code.</para>
183
184 <variablelist class='journal-directives'>
185 <varlistentry>
186 <term><varname>_PID=</varname></term>
187 <term><varname>_UID=</varname></term>
188 <term><varname>_GID=</varname></term>
189 <listitem>
190 <para>The process, user, and group ID of the process the
191 journal entry originates from formatted as a decimal
192 string. Note that entries obtained via <literal>stdout</literal> or
193 <literal>stderr</literal> of forked processes will contain credentials valid for a parent
194 process (that initiated the connection to <command>systemd-journald</command>).</para>
195 </listitem>
196 </varlistentry>
197
198 <varlistentry>
199 <term><varname>_COMM=</varname></term>
200 <term><varname>_EXE=</varname></term>
201 <term><varname>_CMDLINE=</varname></term>
202 <listitem>
203 <para>The name, the executable path, and the command line of
204 the process the journal entry originates from.</para>
205 </listitem>
206 </varlistentry>
207
208 <varlistentry>
209 <term><varname>_CAP_EFFECTIVE=</varname></term>
210 <listitem>
211 <para>The effective
212 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
213 of the process the journal entry originates from.</para>
214 </listitem>
215 </varlistentry>
216
217 <varlistentry>
218 <term><varname>_AUDIT_SESSION=</varname></term>
219 <term><varname>_AUDIT_LOGINUID=</varname></term>
220 <listitem>
221 <para>The session and login UID of the process the journal
222 entry originates from, as maintained by the kernel audit
223 subsystem.</para>
224 </listitem>
225 </varlistentry>
226
227 <varlistentry>
228 <term><varname>_SYSTEMD_CGROUP=</varname></term>
229 <term><varname>_SYSTEMD_SLICE=</varname></term>
230 <term><varname>_SYSTEMD_UNIT=</varname></term>
231 <term><varname>_SYSTEMD_USER_UNIT=</varname></term>
232 <term><varname>_SYSTEMD_USER_SLICE=</varname></term>
233 <term><varname>_SYSTEMD_SESSION=</varname></term>
234 <term><varname>_SYSTEMD_OWNER_UID=</varname></term>
235
236 <listitem>
237 <para>The control group path in the systemd hierarchy, the systemd slice unit name, the systemd
238 unit name, the unit name in the systemd user manager (if any), the systemd session ID (if any), and
239 the owner UID of the systemd user unit or systemd session (if any) of the process the journal entry
240 originates from.</para>
241 </listitem>
242 </varlistentry>
243
244 <varlistentry>
245 <term><varname>_SELINUX_CONTEXT=</varname></term>
246 <listitem>
247 <para>The SELinux security context (label) of the process
248 the journal entry originates from.</para>
249 </listitem>
250 </varlistentry>
251
252 <varlistentry>
253 <term><varname>_SOURCE_REALTIME_TIMESTAMP=</varname></term>
254 <listitem>
255 <para>The earliest trusted timestamp of the message, if any
256 is known that is different from the reception time of the
257 journal. This is the time in microseconds since the epoch
258 UTC, formatted as a decimal string.</para>
259 </listitem>
260 </varlistentry>
261
262 <varlistentry>
263 <term><varname>_BOOT_ID=</varname></term>
264 <listitem>
265 <para>The kernel boot ID for the boot the message was
266 generated in, formatted as a 128-bit hexadecimal
267 string.</para>
268 </listitem>
269 </varlistentry>
270
271 <varlistentry>
272 <term><varname>_MACHINE_ID=</varname></term>
273 <listitem>
274 <para>The machine ID of the originating host, as available
275 in
276 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
277 </listitem>
278 </varlistentry>
279
280 <varlistentry>
281 <term><varname>_SYSTEMD_INVOCATION_ID=</varname></term>
282 <listitem>
283 <para>The invocation ID for the runtime cycle of the unit
284 the message was generated in, as available to processes
285 of the unit in <varname>$INVOCATION_ID</varname> (see
286 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>).</para>
287 </listitem>
288 </varlistentry>
289
290 <varlistentry>
291 <term><varname>_HOSTNAME=</varname></term>
292 <listitem>
293 <para>The name of the originating host.</para>
294 </listitem>
295 </varlistentry>
296
297 <varlistentry>
298 <term><varname>_TRANSPORT=</varname></term>
299 <listitem>
300 <para>How the entry was received by the journal service.
301 Valid transports are:
302 </para>
303 <variablelist>
304 <varlistentry>
305 <term>
306 <option>audit</option>
307 </term>
308 <listitem>
309 <para>for those read from the kernel audit subsystem
310 </para>
311 </listitem>
312 </varlistentry>
313
314 <varlistentry>
315 <term>
316 <option>driver</option>
317 </term>
318 <listitem>
319 <para>for internally generated messages
320 </para>
321 </listitem>
322 </varlistentry>
323
324 <varlistentry>
325 <term>
326 <option>syslog</option>
327 </term>
328 <listitem>
329 <para>for those received via the local syslog socket
330 with the syslog protocol
331 </para>
332 </listitem>
333 </varlistentry>
334
335 <varlistentry>
336 <term>
337 <option>journal</option>
338 </term>
339 <listitem>
340 <para>for those received via the native journal
341 protocol
342 </para>
343 </listitem>
344 </varlistentry>
345
346 <varlistentry>
347 <term>
348 <option>stdout</option>
349 </term>
350 <listitem>
351 <para>for those read from a service's standard output
352 or error output
353 </para>
354 </listitem>
355 </varlistentry>
356
357 <varlistentry>
358 <term>
359 <option>kernel</option>
360 </term>
361 <listitem>
362 <para>for those read from the kernel
363 </para>
364 </listitem>
365 </varlistentry>
366 </variablelist>
367 </listitem>
368 </varlistentry>
369 <varlistentry>
370 <term><varname>_STREAM_ID=</varname></term>
371 <listitem>
372 <para>Only applies to <literal>_TRANSPORT=stdout</literal> records: specifies a randomized 128bit ID assigned
373 to the stream connection when it was first created. This ID is useful to reconstruct individual log streams
374 from the log records: all log records carrying the same stream ID originate from the same stream.</para>
375 </listitem>
376 </varlistentry>
377 <varlistentry>
378 <term><varname>_LINE_BREAK=</varname></term>
379 <listitem>
380 <para>Only applies to <literal>_TRANSPORT=stdout</literal> records: indicates that the log message
381 in the standard output/error stream was not terminated with a normal newline character
382 (<literal>\n</literal>, i.e. ASCII 10). Specifically, when set this field is one of
383 <option>nul</option> (in case the line was terminated by a <constant>NUL</constant> byte), <option>line-max</option> (in
384 case the maximum log line length was reached, as configured with <varname>LineMax=</varname> in
385 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
386 <option>eof</option> (if this was the last log record of a stream and the stream ended without a
387 final newline character), or <option>pid-change</option> (if the process which generated the log
388 output changed in the middle of a line). Note that this record is not generated when a normal
389 newline character was used for marking the log line end.</para>
390 </listitem>
391 </varlistentry>
392 <varlistentry>
393 <term><varname>_NAMESPACE=</varname></term>
394
395 <listitem><para>If this file was written by a <command>systemd-journald</command> instance managing a
396 journal namespace that is not the default, this field contains the namespace identifier. See
397 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
398 for details about journal namespaces.</para>
399 </listitem>
400 </varlistentry>
401 <varlistentry>
402 <term><varname>_SYSTEM_CONTEXT=</varname></term>
403
404 <listitem><para>A string field that specifies the context in which the message was logged. If
405 <literal>initrd</literal>, the log message was processed while systemd-journald
406 was running inside the initrd. If <literal>main</literal>, the log message was generated after
407 journald switched root to the root filesystem.</para></listitem>
408 </varlistentry>
409 </variablelist>
410 </refsect1>
411
412 <refsect1>
413 <title>Kernel Journal Fields</title>
414
415 <para>Kernel fields are fields that are used by messages
416 originating in the kernel and stored in the journal.</para>
417
418 <variablelist class='journal-directives'>
419 <varlistentry>
420 <term><varname>_KERNEL_DEVICE=</varname></term>
421 <listitem>
422 <para>The kernel device name. If the entry is associated to a block device, contains the major and
423 minor numbers of the device node, separated by <literal>:</literal> and prefixed by
424 <literal>b</literal>. Similarly for character devices, but prefixed by <literal>c</literal>. For
425 network devices, this is the interface index prefixed by <literal>n</literal>. For all other
426 devices, this is the subsystem name prefixed by <literal>+</literal>, followed by
427 <literal>:</literal>, followed by the kernel device name.</para>
428 </listitem>
429 </varlistentry>
430 <varlistentry>
431 <term><varname>_KERNEL_SUBSYSTEM=</varname></term>
432 <listitem>
433 <para>The kernel subsystem name.</para>
434 </listitem>
435 </varlistentry>
436 <varlistentry>
437 <term><varname>_UDEV_SYSNAME=</varname></term>
438 <listitem>
439 <para>The kernel device name as it shows up in the device
440 tree below <filename>/sys/</filename>.</para>
441 </listitem>
442 </varlistentry>
443 <varlistentry>
444 <term><varname>_UDEV_DEVNODE=</varname></term>
445 <listitem>
446 <para>The device node path of this device in
447 <filename>/dev/</filename>.</para>
448 </listitem>
449 </varlistentry>
450 <varlistentry>
451 <term><varname>_UDEV_DEVLINK=</varname></term>
452 <listitem>
453 <para>Additional symlink names pointing to the device node
454 in <filename>/dev/</filename>. This field is frequently set
455 more than once per entry.</para>
456 </listitem>
457 </varlistentry>
458 </variablelist>
459 </refsect1>
460
461 <refsect1>
462 <title>Fields to log on behalf of a different program</title>
463
464 <para>Fields in this section are used by programs to specify that
465 they are logging on behalf of another program or unit.
466 </para>
467
468 <para>Fields used by the <command>systemd-coredump</command>
469 coredump kernel helper:
470 </para>
471
472 <variablelist class='journal-directives'>
473 <varlistentry>
474 <term><varname>COREDUMP_UNIT=</varname></term>
475 <term><varname>COREDUMP_USER_UNIT=</varname></term>
476 <listitem>
477 <para>Used to annotate messages containing coredumps from
478 system and session units. See
479 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
480 </para>
481 </listitem>
482 </varlistentry>
483 </variablelist>
484
485 <para>Privileged programs (currently UID 0) may attach
486 <varname>OBJECT_PID=</varname> to a message. This will instruct
487 <command>systemd-journald</command> to attach additional fields on
488 behalf of the caller:</para>
489
490 <variablelist class='journal-directives'>
491 <varlistentry>
492 <term><varname>OBJECT_PID=<replaceable>PID</replaceable></varname></term>
493 <listitem>
494 <para>PID of the program that this message pertains to.
495 </para>
496 </listitem>
497 </varlistentry>
498
499 <varlistentry>
500 <term><varname>OBJECT_UID=</varname></term>
501 <term><varname>OBJECT_GID=</varname></term>
502 <term><varname>OBJECT_COMM=</varname></term>
503 <term><varname>OBJECT_EXE=</varname></term>
504 <term><varname>OBJECT_CMDLINE=</varname></term>
505 <term><varname>OBJECT_AUDIT_SESSION=</varname></term>
506 <term><varname>OBJECT_AUDIT_LOGINUID=</varname></term>
507 <term><varname>OBJECT_SYSTEMD_CGROUP=</varname></term>
508 <term><varname>OBJECT_SYSTEMD_SESSION=</varname></term>
509 <term><varname>OBJECT_SYSTEMD_OWNER_UID=</varname></term>
510 <term><varname>OBJECT_SYSTEMD_UNIT=</varname></term>
511 <term><varname>OBJECT_SYSTEMD_USER_UNIT=</varname></term>
512 <listitem>
513 <para>These are additional fields added automatically by
514 <command>systemd-journald</command>. Their meaning is the
515 same as
516 <varname>_UID=</varname>,
517 <varname>_GID=</varname>,
518 <varname>_COMM=</varname>,
519 <varname>_EXE=</varname>,
520 <varname>_CMDLINE=</varname>,
521 <varname>_AUDIT_SESSION=</varname>,
522 <varname>_AUDIT_LOGINUID=</varname>,
523 <varname>_SYSTEMD_CGROUP=</varname>,
524 <varname>_SYSTEMD_SESSION=</varname>,
525 <varname>_SYSTEMD_UNIT=</varname>,
526 <varname>_SYSTEMD_USER_UNIT=</varname>, and
527 <varname>_SYSTEMD_OWNER_UID=</varname>
528 as described above, except that the process identified by
529 <replaceable>PID</replaceable> is described, instead of the
530 process which logged the message.</para>
531 </listitem>
532 </varlistentry>
533 </variablelist>
534
535 </refsect1>
536
537 <refsect1>
538 <title>Address Fields</title>
539
540 <para>During serialization into external formats, such as the
541 <ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink>
542 or the
543 <ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format">Journal JSON Format</ulink>,
544 the addresses of journal entries are
545 serialized into fields prefixed with double underscores. Note that
546 these are not proper fields when stored in the journal but for
547 addressing metadata of entries. They cannot be written as part of
548 structured log entries via calls such as
549 <citerefentry><refentrytitle>sd_journal_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
550 They may also not be used as matches for
551 <citerefentry><refentrytitle>sd_journal_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
552 </para>
553
554 <variablelist class='journal-directives'>
555 <varlistentry>
556 <term><varname>__CURSOR=</varname></term>
557 <listitem>
558 <para>The cursor for the entry. A cursor is an opaque text
559 string that uniquely describes the position of an entry in
560 the journal and is portable across machines, platforms and
561 journal files.
562 </para>
563 </listitem>
564 </varlistentry>
565
566 <varlistentry>
567 <term><varname>__REALTIME_TIMESTAMP=</varname></term>
568 <listitem>
569 <para>The wallclock time
570 (<constant>CLOCK_REALTIME</constant>) at the point in time
571 the entry was received by the journal, in microseconds since
572 the epoch UTC, formatted as a decimal string. This has
573 different properties from
574 <literal>_SOURCE_REALTIME_TIMESTAMP=</literal>, as it is
575 usually a bit later but more likely to be monotonic.
576 </para>
577 </listitem>
578 </varlistentry>
579
580 <varlistentry>
581 <term><varname>__MONOTONIC_TIMESTAMP=</varname></term>
582 <listitem>
583 <para>The monotonic time
584 (<constant>CLOCK_MONOTONIC</constant>) at the point in time
585 the entry was received by the journal in microseconds,
586 formatted as a decimal string. To be useful as an address
587 for the entry, this should be combined with the boot ID in
588 <literal>_BOOT_ID=</literal>.
589 </para>
590 </listitem>
591 </varlistentry>
592 </variablelist>
593 </refsect1>
594
595 <refsect1>
596 <title>See Also</title>
597 <para>
598 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
599 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
600 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
601 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
602 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
603 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
604 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
605 </para>
606 </refsect1>
607
608 </refentry>