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">
6 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2010 Lennart Poettering
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 <refentry id=
"systemd.journal-fields">
29 <title>systemd.journal-fields
</title>
30 <productname>systemd
</productname>
34 <contrib>Developer
</contrib>
35 <firstname>Lennart
</firstname>
36 <surname>Poettering
</surname>
37 <email>lennart@poettering.net
</email>
43 <refentrytitle>systemd.journal-fields
</refentrytitle>
44 <manvolnum>7</manvolnum>
48 <refname>systemd.journal-fields
</refname>
49 <refpurpose>Special journal fields
</refpurpose>
53 <title>Description
</title>
55 <para>Entries in the journal resemble an environment block in
56 their syntax but with fields that can include binary data.
57 Primarily, fields are formatted UTF-
8 text strings, and binary
58 formatting is used only where formatting as UTF-
8 text strings
59 makes little sense. New fields may freely be defined by
60 applications, but a few fields have special meaning. All fields
61 with special meanings are optional. In some cases, fields may
62 appear more than once per entry.
</para>
66 <title>User Journal Fields
</title>
68 <para>User fields are fields that are directly passed from clients
69 and stored in the journal.
</para>
71 <variablelist class='journal-directives'
>
73 <term><varname>MESSAGE=
</varname></term>
75 <para>The human-readable message string for this entry. This
76 is supposed to be the primary text shown to the user. It is
77 usually not translated (but might be in some cases), and is
78 not supposed to be parsed for metadata.
</para>
83 <term><varname>MESSAGE_ID=
</varname></term>
85 <para>A
128-bit message identifier ID for recognizing
86 certain message types, if this is desirable. This should
87 contain a
128-bit ID formatted as a lower-case hexadecimal
88 string, without any separating dashes or suchlike. This is
89 recommended to be a UUID-compatible ID, but this is not
90 enforced, and formatted differently. Developers can generate
91 a new ID for this purpose with
<command>journalctl
92 <option>--new-id128
</option></command>.
98 <term><varname>PRIORITY=
</varname></term>
100 <para>A priority value between
0 (
<literal>emerg
</literal>)
101 and
7 (
<literal>debug
</literal>) formatted as a decimal
102 string. This field is compatible with syslog's priority
108 <term><varname>CODE_FILE=
</varname></term>
109 <term><varname>CODE_LINE=
</varname></term>
110 <term><varname>CODE_FUNC=
</varname></term>
112 <para>The code location generating this message, if known.
113 Contains the source filename, the line number and the
114 function name.
</para>
119 <term><varname>ERRNO=
</varname></term>
121 <para>The low-level Unix error number causing this entry, if
122 any. Contains the numeric value of
123 <citerefentry project='man-pages'
><refentrytitle>errno
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
124 formatted as a decimal string.
</para>
129 <term><varname>SYSLOG_FACILITY=
</varname></term>
130 <term><varname>SYSLOG_IDENTIFIER=
</varname></term>
131 <term><varname>SYSLOG_PID=
</varname></term>
133 <para>Syslog compatibility fields containing the facility
134 (formatted as decimal string), the identifier string (i.e.
135 "tag"), and the client PID. (Note that the tag is usually
137 <varname>program_invocation_short_name
</varname> variable,
139 <citerefentry project='die-net'
><refentrytitle>program_invocation_short_name
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.)
</para>
147 <title>Trusted Journal Fields
</title>
149 <para>Fields prefixed with an underscore are trusted fields, i.e.
150 fields that are implicitly added by the journal and cannot be
151 altered by client code.
</para>
153 <variablelist class='journal-directives'
>
155 <term><varname>_PID=
</varname></term>
156 <term><varname>_UID=
</varname></term>
157 <term><varname>_GID=
</varname></term>
159 <para>The process, user, and group ID of the process the
160 journal entry originates from formatted as a decimal
161 string. Note that entries obtained via
<literal>stdout
</literal> or
162 <literal>stderr
</literal> of forked processes will contain credentials valid for a parent
163 process (that initiated the connection to
<command>systemd-journald
</command>).
</para>
168 <term><varname>_COMM=
</varname></term>
169 <term><varname>_EXE=
</varname></term>
170 <term><varname>_CMDLINE=
</varname></term>
172 <para>The name, the executable path, and the command line of
173 the process the journal entry originates from.
</para>
178 <term><varname>_CAP_EFFECTIVE=
</varname></term>
181 <citerefentry project='man-pages'
><refentrytitle>capabilities
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
182 of the process the journal entry originates from.
</para>
187 <term><varname>_AUDIT_SESSION=
</varname></term>
188 <term><varname>_AUDIT_LOGINUID=
</varname></term>
190 <para>The session and login UID of the process the journal
191 entry originates from, as maintained by the kernel audit
197 <term><varname>_SYSTEMD_CGROUP=
</varname></term>
198 <term><varname>_SYSTEMD_SLICE=
</varname></term>
199 <term><varname>_SYSTEMD_UNIT=
</varname></term>
200 <term><varname>_SYSTEMD_USER_UNIT=
</varname></term>
201 <term><varname>_SYSTEMD_SESSION=
</varname></term>
202 <term><varname>_SYSTEMD_OWNER_UID=
</varname></term>
205 <para>The control group path in the systemd hierarchy, the
206 the systemd slice unit name, the systemd unit name, the
207 unit name in the systemd user manager (if any), the systemd
208 session ID (if any), and the owner UID of the systemd user
209 unit or systemd session (if any) of the process the journal
210 entry originates from.
</para>
215 <term><varname>_SELINUX_CONTEXT=
</varname></term>
217 <para>The SELinux security context (label) of the process
218 the journal entry originates from.
</para>
223 <term><varname>_SOURCE_REALTIME_TIMESTAMP=
</varname></term>
225 <para>The earliest trusted timestamp of the message, if any
226 is known that is different from the reception time of the
227 journal. This is the time in microseconds since the epoch
228 UTC, formatted as a decimal string.
</para>
233 <term><varname>_BOOT_ID=
</varname></term>
235 <para>The kernel boot ID for the boot the message was
236 generated in, formatted as a
128-bit hexadecimal
242 <term><varname>_MACHINE_ID=
</varname></term>
244 <para>The machine ID of the originating host, as available
246 <citerefentry><refentrytitle>machine-id
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
251 <term><varname>_SYSTEMD_INVOCATION_ID=
</varname></term>
253 <para>The invocation ID for the runtime cycle of the unit
254 the message was generated in, as available to processes
255 of the unit in
<varname>$INVOCATION_ID
</varname> (see
256 <citerefentry><refentrytitle>systemd.exec
</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
</para>
261 <term><varname>_HOSTNAME=
</varname></term>
263 <para>The name of the originating host.
</para>
268 <term><varname>_TRANSPORT=
</varname></term>
270 <para>How the entry was received by the journal service.
271 Valid transports are:
276 <option>audit
</option>
279 <para>for those read from the kernel audit subsystem
286 <option>driver
</option>
289 <para>for internally generated messages
296 <option>syslog
</option>
299 <para>for those received via the local syslog socket
300 with the syslog protocol
307 <option>journal
</option>
310 <para>for those received via the native journal
318 <option>stdout
</option>
321 <para>for those read from a service's standard output
329 <option>kernel
</option>
332 <para>for those read from the kernel
340 <term><varname>_STREAM_ID=
</varname></term>
342 <para>Only applies to
<literal>_TRANSPORT=stream
</literal> records: specifies a randomized
128bit ID assigned
343 to the stream connection when it was first created. This ID is useful to reconstruct individual log streams
344 from the log records: all log records carrying the same stream ID originate from the same stream.
</para>
348 <term><varname>_LINE_BREAK=
</varname></term>
350 <para>Only applies to
<literal>_TRANSPORT=stream
</literal> records: indicates that the log message in the
351 standard output/error stream was not terminated with a normal newline character (
<literal>\n
</literal>,
352 i.e. ASCII
10). Specifically, when set this field is one of
<option>nul
</option> (in case the line was
353 terminated by a NUL byte),
<option>line-max
</option> (in case the maximum log line length was reached, as
354 configured with
<varname>LineMax=
</varname> in
355 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>) or
356 <option>eof
</option> (if this was the last log record of a stream and the stream ended without a final
357 newline character). Note that this record is not generated when a normal newline character was used for
358 marking the log line end.
</para>
365 <title>Kernel Journal Fields
</title>
367 <para>Kernel fields are fields that are used by messages
368 originating in the kernel and stored in the journal.
</para>
370 <variablelist class='journal-directives'
>
372 <term><varname>_KERNEL_DEVICE=
</varname></term>
374 <para>The kernel device name. If the entry is associated to
375 a block device, the major and minor of the device node,
376 separated by
<literal>:
</literal> and prefixed by
377 <literal>b
</literal>. Similar for character devices but
378 prefixed by
<literal>c
</literal>. For network devices, this
379 is the interface index prefixed by
<literal>n
</literal>. For
380 all other devices, this is the subsystem name prefixed by
381 <literal>+
</literal>, followed by
<literal>:
</literal>,
382 followed by the kernel device name.
</para>
386 <term><varname>_KERNEL_SUBSYSTEM=
</varname></term>
388 <para>The kernel subsystem name.
</para>
392 <term><varname>_UDEV_SYSNAME=
</varname></term>
394 <para>The kernel device name as it shows up in the device
395 tree below
<filename>/sys
</filename>.
</para>
399 <term><varname>_UDEV_DEVNODE=
</varname></term>
401 <para>The device node path of this device in
402 <filename>/dev
</filename>.
</para>
406 <term><varname>_UDEV_DEVLINK=
</varname></term>
408 <para>Additional symlink names pointing to the device node
409 in
<filename>/dev
</filename>. This field is frequently set
410 more than once per entry.
</para>
417 <title>Fields to log on behalf of a different program
</title>
419 <para>Fields in this section are used by programs to specify that
420 they are logging on behalf of another program or unit.
423 <para>Fields used by the
<command>systemd-coredump
</command>
424 coredump kernel helper:
427 <variablelist class='journal-directives'
>
429 <term><varname>COREDUMP_UNIT=
</varname></term>
430 <term><varname>COREDUMP_USER_UNIT=
</varname></term>
432 <para>Used to annotate messages containing coredumps from
433 system and session units. See
434 <citerefentry><refentrytitle>coredumpctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
440 <para>Privileged programs (currently UID
0) may attach
441 <varname>OBJECT_PID=
</varname> to a message. This will instruct
442 <command>systemd-journald
</command> to attach additional fields on
443 behalf of the caller:
</para>
445 <variablelist class='journal-directives'
>
447 <term><varname>OBJECT_PID=
<replaceable>PID
</replaceable></varname></term>
449 <para>PID of the program that this message pertains to.
455 <term><varname>OBJECT_UID=
</varname></term>
456 <term><varname>OBJECT_GID=
</varname></term>
457 <term><varname>OBJECT_COMM=
</varname></term>
458 <term><varname>OBJECT_EXE=
</varname></term>
459 <term><varname>OBJECT_CMDLINE=
</varname></term>
460 <term><varname>OBJECT_AUDIT_SESSION=
</varname></term>
461 <term><varname>OBJECT_AUDIT_LOGINUID=
</varname></term>
462 <term><varname>OBJECT_SYSTEMD_CGROUP=
</varname></term>
463 <term><varname>OBJECT_SYSTEMD_SESSION=
</varname></term>
464 <term><varname>OBJECT_SYSTEMD_OWNER_UID=
</varname></term>
465 <term><varname>OBJECT_SYSTEMD_UNIT=
</varname></term>
466 <term><varname>OBJECT_SYSTEMD_USER_UNIT=
</varname></term>
468 <para>These are additional fields added automatically by
469 <command>systemd-journald
</command>. Their meaning is the
471 <varname>_UID=
</varname>,
472 <varname>_GID=
</varname>,
473 <varname>_COMM=
</varname>,
474 <varname>_EXE=
</varname>,
475 <varname>_CMDLINE=
</varname>,
476 <varname>_AUDIT_SESSION=
</varname>,
477 <varname>_AUDIT_LOGINUID=
</varname>,
478 <varname>_SYSTEMD_CGROUP=
</varname>,
479 <varname>_SYSTEMD_SESSION=
</varname>,
480 <varname>_SYSTEMD_UNIT=
</varname>,
481 <varname>_SYSTEMD_USER_UNIT=
</varname>, and
482 <varname>_SYSTEMD_OWNER_UID=
</varname>
483 as described above, except that the process identified by
484 <replaceable>PID
</replaceable> is described, instead of the
485 process which logged the message.
</para>
493 <title>Address Fields
</title>
495 <para>During serialization into external formats, such as the
497 url=
"https://www.freedesktop.org/wiki/Software/systemd/export">Journal
498 Export Format
</ulink> or the
<ulink
499 url=
"https://www.freedesktop.org/wiki/Software/systemd/json">Journal
500 JSON Format
</ulink>, the addresses of journal entries are
501 serialized into fields prefixed with double underscores. Note that
502 these are not proper fields when stored in the journal but for
503 addressing metadata of entries. They cannot be written as part of
504 structured log entries via calls such as
505 <citerefentry><refentrytitle>sd_journal_send
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
506 They may also not be used as matches for
507 <citerefentry><refentrytitle>sd_journal_add_match
</refentrytitle><manvolnum>3</manvolnum></citerefentry></para>
509 <variablelist class='journal-directives'
>
511 <term><varname>__CURSOR=
</varname></term>
513 <para>The cursor for the entry. A cursor is an opaque text
514 string that uniquely describes the position of an entry in
515 the journal and is portable across machines, platforms and
522 <term><varname>__REALTIME_TIMESTAMP=
</varname></term>
524 <para>The wallclock time
525 (
<constant>CLOCK_REALTIME
</constant>) at the point in time
526 the entry was received by the journal, in microseconds since
527 the epoch UTC, formatted as a decimal string. This has
528 different properties from
529 <literal>_SOURCE_REALTIME_TIMESTAMP=
</literal>, as it is
530 usually a bit later but more likely to be monotonic.
536 <term><varname>__MONOTONIC_TIMESTAMP=
</varname></term>
538 <para>The monotonic time
539 (
<constant>CLOCK_MONOTONIC
</constant>) at the point in time
540 the entry was received by the journal in microseconds,
541 formatted as a decimal string. To be useful as an address
542 for the entry, this should be combined with the boot ID in
543 <literal>_BOOT_ID=
</literal>.
551 <title>See Also
</title>
553 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
554 <citerefentry><refentrytitle>journalctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
555 <citerefentry><refentrytitle>journald.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
556 <citerefentry><refentrytitle>sd-journal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
557 <citerefentry><refentrytitle>coredumpctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
558 <citerefentry><refentrytitle>systemd.directives
</refentrytitle><manvolnum>7</manvolnum></citerefentry>