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+ -->
6 <refentry id=
"systemd.journal-fields">
9 <title>systemd.journal-fields
</title>
10 <productname>systemd
</productname>
14 <refentrytitle>systemd.journal-fields
</refentrytitle>
15 <manvolnum>7</manvolnum>
19 <refname>systemd.journal-fields
</refname>
20 <refpurpose>Special journal fields
</refpurpose>
24 <title>Description
</title>
26 <para>Entries in the journal resemble an environment block in
27 their syntax but with fields that can include binary data.
28 Primarily, fields are formatted UTF-
8 text strings, and binary
29 formatting is used only where formatting as UTF-
8 text strings
30 makes little sense. New fields may freely be defined by
31 applications, but a few fields have special meaning. All fields
32 with special meanings are optional. In some cases, fields may
33 appear more than once per entry.
</para>
37 <title>User Journal Fields
</title>
39 <para>User fields are fields that are directly passed from clients
40 and stored in the journal.
</para>
42 <variablelist class='journal-directives'
>
44 <term><varname>MESSAGE=
</varname></term>
46 <para>The human-readable message string for this entry. This
47 is supposed to be the primary text shown to the user. It is
48 usually not translated (but might be in some cases), and is
49 not supposed to be parsed for metadata.
</para>
54 <term><varname>MESSAGE_ID=
</varname></term>
56 <para>A
128-bit message identifier ID for recognizing certain message types, if this is desirable. This
57 should contain a
128-bit ID formatted as a lower-case hexadecimal string, without any separating dashes or
58 suchlike. This is recommended to be a UUID-compatible ID, but this is not enforced, and formatted
59 differently. Developers can generate a new ID for this purpose with
<command>systemd-id128 new
</command>.
65 <term><varname>PRIORITY=
</varname></term>
67 <para>A priority value between
0 (
<literal>emerg
</literal>)
68 and
7 (
<literal>debug
</literal>) formatted as a decimal
69 string. This field is compatible with syslog's priority
75 <term><varname>CODE_FILE=
</varname></term>
76 <term><varname>CODE_LINE=
</varname></term>
77 <term><varname>CODE_FUNC=
</varname></term>
79 <para>The code location generating this message, if known.
80 Contains the source filename, the line number and the
86 <term><varname>ERRNO=
</varname></term>
88 <para>The low-level Unix error number causing this entry, if
89 any. Contains the numeric value of
90 <citerefentry project='man-pages'
><refentrytitle>errno
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
91 formatted as a decimal string.
</para>
96 <term><varname>SYSLOG_FACILITY=
</varname></term>
97 <term><varname>SYSLOG_IDENTIFIER=
</varname></term>
98 <term><varname>SYSLOG_PID=
</varname></term>
99 <term><varname>SYSLOG_TIMESTAMP=
</varname></term>
101 <para>Syslog compatibility fields containing the facility (formatted as
102 decimal string), the identifier string (i.e.
"tag"), the client PID, and
103 the timestamp as specified in the original datagram. (Note that the tag is
104 usually derived from glibc's
105 <varname>program_invocation_short_name
</varname> variable, see
106 <citerefentry project='die-net'
><refentrytitle>program_invocation_short_name
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.)
</para>
107 <para>Note that the journal service does not validate the values of any structured
108 journal fields whose name is not prefixed with an underscore, and this includes any
109 syslog related fields such as these. Hence, applications that supply a facility, PID,
110 or log level are expected to do so properly formatted, i.e. as numeric integers formatted
111 as decimal strings.
</para>
116 <term><varname>SYSLOG_RAW=
</varname></term>
118 <para>The original contents of the syslog line as received in the syslog
119 datagram. This field is only included if the
<varname>MESSAGE=
</varname>
120 field was modified compared to the original payload or the timestamp could
121 not be located properly and is not included in
122 <varname>SYSLOG_TIMESTAMP=
</varname>. Message truncation occurs when when
123 the message contains leading or trailing whitespace (trailing and leading
124 whitespace is stripped), or it contains an embedded
125 <constant>NUL
</constant> byte (the
<constant>NUL
</constant> byte and
126 anything after it is not included). Thus, the original syslog line is
127 either stored as
<varname>SYSLOG_RAW=
</varname> or it can be recreated
128 based on the stored priority and facility, timestamp, identifier, and the
129 message payload in
<varname>MESSAGE=
</varname>.
137 <title>Trusted Journal Fields
</title>
139 <para>Fields prefixed with an underscore are trusted fields, i.e.
140 fields that are implicitly added by the journal and cannot be
141 altered by client code.
</para>
143 <variablelist class='journal-directives'
>
145 <term><varname>_PID=
</varname></term>
146 <term><varname>_UID=
</varname></term>
147 <term><varname>_GID=
</varname></term>
149 <para>The process, user, and group ID of the process the
150 journal entry originates from formatted as a decimal
151 string. Note that entries obtained via
<literal>stdout
</literal> or
152 <literal>stderr
</literal> of forked processes will contain credentials valid for a parent
153 process (that initiated the connection to
<command>systemd-journald
</command>).
</para>
158 <term><varname>_COMM=
</varname></term>
159 <term><varname>_EXE=
</varname></term>
160 <term><varname>_CMDLINE=
</varname></term>
162 <para>The name, the executable path, and the command line of
163 the process the journal entry originates from.
</para>
168 <term><varname>_CAP_EFFECTIVE=
</varname></term>
171 <citerefentry project='man-pages'
><refentrytitle>capabilities
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
172 of the process the journal entry originates from.
</para>
177 <term><varname>_AUDIT_SESSION=
</varname></term>
178 <term><varname>_AUDIT_LOGINUID=
</varname></term>
180 <para>The session and login UID of the process the journal
181 entry originates from, as maintained by the kernel audit
187 <term><varname>_SYSTEMD_CGROUP=
</varname></term>
188 <term><varname>_SYSTEMD_SLICE=
</varname></term>
189 <term><varname>_SYSTEMD_UNIT=
</varname></term>
190 <term><varname>_SYSTEMD_USER_UNIT=
</varname></term>
191 <term><varname>_SYSTEMD_USER_SLICE=
</varname></term>
192 <term><varname>_SYSTEMD_SESSION=
</varname></term>
193 <term><varname>_SYSTEMD_OWNER_UID=
</varname></term>
196 <para>The control group path in the systemd hierarchy, the
197 the systemd slice unit name, the systemd unit name, the
198 unit name in the systemd user manager (if any), the systemd
199 session ID (if any), and the owner UID of the systemd user
200 unit or systemd session (if any) of the process the journal
201 entry originates from.
</para>
206 <term><varname>_SELINUX_CONTEXT=
</varname></term>
208 <para>The SELinux security context (label) of the process
209 the journal entry originates from.
</para>
214 <term><varname>_SOURCE_REALTIME_TIMESTAMP=
</varname></term>
216 <para>The earliest trusted timestamp of the message, if any
217 is known that is different from the reception time of the
218 journal. This is the time in microseconds since the epoch
219 UTC, formatted as a decimal string.
</para>
224 <term><varname>_BOOT_ID=
</varname></term>
226 <para>The kernel boot ID for the boot the message was
227 generated in, formatted as a
128-bit hexadecimal
233 <term><varname>_MACHINE_ID=
</varname></term>
235 <para>The machine ID of the originating host, as available
237 <citerefentry><refentrytitle>machine-id
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
242 <term><varname>_SYSTEMD_INVOCATION_ID=
</varname></term>
244 <para>The invocation ID for the runtime cycle of the unit
245 the message was generated in, as available to processes
246 of the unit in
<varname>$INVOCATION_ID
</varname> (see
247 <citerefentry><refentrytitle>systemd.exec
</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
</para>
252 <term><varname>_HOSTNAME=
</varname></term>
254 <para>The name of the originating host.
</para>
259 <term><varname>_TRANSPORT=
</varname></term>
261 <para>How the entry was received by the journal service.
262 Valid transports are:
267 <option>audit
</option>
270 <para>for those read from the kernel audit subsystem
277 <option>driver
</option>
280 <para>for internally generated messages
287 <option>syslog
</option>
290 <para>for those received via the local syslog socket
291 with the syslog protocol
298 <option>journal
</option>
301 <para>for those received via the native journal
309 <option>stdout
</option>
312 <para>for those read from a service's standard output
320 <option>kernel
</option>
323 <para>for those read from the kernel
331 <term><varname>_STREAM_ID=
</varname></term>
333 <para>Only applies to
<literal>_TRANSPORT=stdout
</literal> records: specifies a randomized
128bit ID assigned
334 to the stream connection when it was first created. This ID is useful to reconstruct individual log streams
335 from the log records: all log records carrying the same stream ID originate from the same stream.
</para>
339 <term><varname>_LINE_BREAK=
</varname></term>
341 <para>Only applies to
<literal>_TRANSPORT=stdout
</literal> records: indicates that the log message in the
342 standard output/error stream was not terminated with a normal newline character (
<literal>\n
</literal>,
343 i.e. ASCII
10). Specifically, when set this field is one of
<option>nul
</option> (in case the line was
344 terminated by a NUL byte),
<option>line-max
</option> (in case the maximum log line length was reached, as
345 configured with
<varname>LineMax=
</varname> in
346 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>) or
347 <option>eof
</option> (if this was the last log record of a stream and the stream ended without a final
348 newline character). Note that this record is not generated when a normal newline character was used for
349 marking the log line end.
</para>
356 <title>Kernel Journal Fields
</title>
358 <para>Kernel fields are fields that are used by messages
359 originating in the kernel and stored in the journal.
</para>
361 <variablelist class='journal-directives'
>
363 <term><varname>_KERNEL_DEVICE=
</varname></term>
365 <para>The kernel device name. If the entry is associated to
366 a block device, the major and minor of the device node,
367 separated by
<literal>:
</literal> and prefixed by
368 <literal>b
</literal>. Similar for character devices but
369 prefixed by
<literal>c
</literal>. For network devices, this
370 is the interface index prefixed by
<literal>n
</literal>. For
371 all other devices, this is the subsystem name prefixed by
372 <literal>+
</literal>, followed by
<literal>:
</literal>,
373 followed by the kernel device name.
</para>
377 <term><varname>_KERNEL_SUBSYSTEM=
</varname></term>
379 <para>The kernel subsystem name.
</para>
383 <term><varname>_UDEV_SYSNAME=
</varname></term>
385 <para>The kernel device name as it shows up in the device
386 tree below
<filename>/sys
</filename>.
</para>
390 <term><varname>_UDEV_DEVNODE=
</varname></term>
392 <para>The device node path of this device in
393 <filename>/dev
</filename>.
</para>
397 <term><varname>_UDEV_DEVLINK=
</varname></term>
399 <para>Additional symlink names pointing to the device node
400 in
<filename>/dev
</filename>. This field is frequently set
401 more than once per entry.
</para>
408 <title>Fields to log on behalf of a different program
</title>
410 <para>Fields in this section are used by programs to specify that
411 they are logging on behalf of another program or unit.
414 <para>Fields used by the
<command>systemd-coredump
</command>
415 coredump kernel helper:
418 <variablelist class='journal-directives'
>
420 <term><varname>COREDUMP_UNIT=
</varname></term>
421 <term><varname>COREDUMP_USER_UNIT=
</varname></term>
423 <para>Used to annotate messages containing coredumps from
424 system and session units. See
425 <citerefentry><refentrytitle>coredumpctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
431 <para>Privileged programs (currently UID
0) may attach
432 <varname>OBJECT_PID=
</varname> to a message. This will instruct
433 <command>systemd-journald
</command> to attach additional fields on
434 behalf of the caller:
</para>
436 <variablelist class='journal-directives'
>
438 <term><varname>OBJECT_PID=
<replaceable>PID
</replaceable></varname></term>
440 <para>PID of the program that this message pertains to.
446 <term><varname>OBJECT_UID=
</varname></term>
447 <term><varname>OBJECT_GID=
</varname></term>
448 <term><varname>OBJECT_COMM=
</varname></term>
449 <term><varname>OBJECT_EXE=
</varname></term>
450 <term><varname>OBJECT_CMDLINE=
</varname></term>
451 <term><varname>OBJECT_AUDIT_SESSION=
</varname></term>
452 <term><varname>OBJECT_AUDIT_LOGINUID=
</varname></term>
453 <term><varname>OBJECT_SYSTEMD_CGROUP=
</varname></term>
454 <term><varname>OBJECT_SYSTEMD_SESSION=
</varname></term>
455 <term><varname>OBJECT_SYSTEMD_OWNER_UID=
</varname></term>
456 <term><varname>OBJECT_SYSTEMD_UNIT=
</varname></term>
457 <term><varname>OBJECT_SYSTEMD_USER_UNIT=
</varname></term>
459 <para>These are additional fields added automatically by
460 <command>systemd-journald
</command>. Their meaning is the
462 <varname>_UID=
</varname>,
463 <varname>_GID=
</varname>,
464 <varname>_COMM=
</varname>,
465 <varname>_EXE=
</varname>,
466 <varname>_CMDLINE=
</varname>,
467 <varname>_AUDIT_SESSION=
</varname>,
468 <varname>_AUDIT_LOGINUID=
</varname>,
469 <varname>_SYSTEMD_CGROUP=
</varname>,
470 <varname>_SYSTEMD_SESSION=
</varname>,
471 <varname>_SYSTEMD_UNIT=
</varname>,
472 <varname>_SYSTEMD_USER_UNIT=
</varname>, and
473 <varname>_SYSTEMD_OWNER_UID=
</varname>
474 as described above, except that the process identified by
475 <replaceable>PID
</replaceable> is described, instead of the
476 process which logged the message.
</para>
484 <title>Address Fields
</title>
486 <para>During serialization into external formats, such as the
488 url=
"https://www.freedesktop.org/wiki/Software/systemd/export">Journal
489 Export Format
</ulink> or the
<ulink
490 url=
"https://www.freedesktop.org/wiki/Software/systemd/json">Journal
491 JSON Format
</ulink>, the addresses of journal entries are
492 serialized into fields prefixed with double underscores. Note that
493 these are not proper fields when stored in the journal but for
494 addressing metadata of entries. They cannot be written as part of
495 structured log entries via calls such as
496 <citerefentry><refentrytitle>sd_journal_send
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
497 They may also not be used as matches for
498 <citerefentry><refentrytitle>sd_journal_add_match
</refentrytitle><manvolnum>3</manvolnum></citerefentry></para>
500 <variablelist class='journal-directives'
>
502 <term><varname>__CURSOR=
</varname></term>
504 <para>The cursor for the entry. A cursor is an opaque text
505 string that uniquely describes the position of an entry in
506 the journal and is portable across machines, platforms and
513 <term><varname>__REALTIME_TIMESTAMP=
</varname></term>
515 <para>The wallclock time
516 (
<constant>CLOCK_REALTIME
</constant>) at the point in time
517 the entry was received by the journal, in microseconds since
518 the epoch UTC, formatted as a decimal string. This has
519 different properties from
520 <literal>_SOURCE_REALTIME_TIMESTAMP=
</literal>, as it is
521 usually a bit later but more likely to be monotonic.
527 <term><varname>__MONOTONIC_TIMESTAMP=
</varname></term>
529 <para>The monotonic time
530 (
<constant>CLOCK_MONOTONIC
</constant>) at the point in time
531 the entry was received by the journal in microseconds,
532 formatted as a decimal string. To be useful as an address
533 for the entry, this should be combined with the boot ID in
534 <literal>_BOOT_ID=
</literal>.
542 <title>See Also
</title>
544 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
545 <citerefentry><refentrytitle>journalctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
546 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
547 <citerefentry><refentrytitle>sd-journal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
548 <citerefentry><refentrytitle>coredumpctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
549 <citerefentry><refentrytitle>systemd.directives
</refentrytitle><manvolnum>7</manvolnum></citerefentry>