]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.journal-fields.xml
man: fix link markup
[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+ -->
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 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 a <literal>http://</literal>, <literal>https://</literal>,
149 <literal>file:/</literal>, <literal>man:</literal> or <literal>info:</literal> URL.</para>
150 </listitem>
151 </varlistentry>
152 </variablelist>
153 </refsect1>
154
155 <refsect1>
156 <title>Trusted Journal Fields</title>
157
158 <para>Fields prefixed with an underscore are trusted fields, i.e.
159 fields that are implicitly added by the journal and cannot be
160 altered by client code.</para>
161
162 <variablelist class='journal-directives'>
163 <varlistentry>
164 <term><varname>_PID=</varname></term>
165 <term><varname>_UID=</varname></term>
166 <term><varname>_GID=</varname></term>
167 <listitem>
168 <para>The process, user, and group ID of the process the
169 journal entry originates from formatted as a decimal
170 string. Note that entries obtained via <literal>stdout</literal> or
171 <literal>stderr</literal> of forked processes will contain credentials valid for a parent
172 process (that initiated the connection to <command>systemd-journald</command>).</para>
173 </listitem>
174 </varlistentry>
175
176 <varlistentry>
177 <term><varname>_COMM=</varname></term>
178 <term><varname>_EXE=</varname></term>
179 <term><varname>_CMDLINE=</varname></term>
180 <listitem>
181 <para>The name, the executable path, and the command line of
182 the process the journal entry originates from.</para>
183 </listitem>
184 </varlistentry>
185
186 <varlistentry>
187 <term><varname>_CAP_EFFECTIVE=</varname></term>
188 <listitem>
189 <para>The effective
190 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
191 of the process the journal entry originates from.</para>
192 </listitem>
193 </varlistentry>
194
195 <varlistentry>
196 <term><varname>_AUDIT_SESSION=</varname></term>
197 <term><varname>_AUDIT_LOGINUID=</varname></term>
198 <listitem>
199 <para>The session and login UID of the process the journal
200 entry originates from, as maintained by the kernel audit
201 subsystem.</para>
202 </listitem>
203 </varlistentry>
204
205 <varlistentry>
206 <term><varname>_SYSTEMD_CGROUP=</varname></term>
207 <term><varname>_SYSTEMD_SLICE=</varname></term>
208 <term><varname>_SYSTEMD_UNIT=</varname></term>
209 <term><varname>_SYSTEMD_USER_UNIT=</varname></term>
210 <term><varname>_SYSTEMD_USER_SLICE=</varname></term>
211 <term><varname>_SYSTEMD_SESSION=</varname></term>
212 <term><varname>_SYSTEMD_OWNER_UID=</varname></term>
213
214 <listitem>
215 <para>The control group path in the systemd hierarchy, the
216 the systemd slice unit name, the systemd unit name, the
217 unit name in the systemd user manager (if any), the systemd
218 session ID (if any), and the owner UID of the systemd user
219 unit or systemd session (if any) of the process the journal
220 entry originates from.</para>
221 </listitem>
222 </varlistentry>
223
224 <varlistentry>
225 <term><varname>_SELINUX_CONTEXT=</varname></term>
226 <listitem>
227 <para>The SELinux security context (label) of the process
228 the journal entry originates from.</para>
229 </listitem>
230 </varlistentry>
231
232 <varlistentry>
233 <term><varname>_SOURCE_REALTIME_TIMESTAMP=</varname></term>
234 <listitem>
235 <para>The earliest trusted timestamp of the message, if any
236 is known that is different from the reception time of the
237 journal. This is the time in microseconds since the epoch
238 UTC, formatted as a decimal string.</para>
239 </listitem>
240 </varlistentry>
241
242 <varlistentry>
243 <term><varname>_BOOT_ID=</varname></term>
244 <listitem>
245 <para>The kernel boot ID for the boot the message was
246 generated in, formatted as a 128-bit hexadecimal
247 string.</para>
248 </listitem>
249 </varlistentry>
250
251 <varlistentry>
252 <term><varname>_MACHINE_ID=</varname></term>
253 <listitem>
254 <para>The machine ID of the originating host, as available
255 in
256 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
257 </listitem>
258 </varlistentry>
259
260 <varlistentry>
261 <term><varname>_SYSTEMD_INVOCATION_ID=</varname></term>
262 <listitem>
263 <para>The invocation ID for the runtime cycle of the unit
264 the message was generated in, as available to processes
265 of the unit in <varname>$INVOCATION_ID</varname> (see
266 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>).</para>
267 </listitem>
268 </varlistentry>
269
270 <varlistentry>
271 <term><varname>_HOSTNAME=</varname></term>
272 <listitem>
273 <para>The name of the originating host.</para>
274 </listitem>
275 </varlistentry>
276
277 <varlistentry>
278 <term><varname>_TRANSPORT=</varname></term>
279 <listitem>
280 <para>How the entry was received by the journal service.
281 Valid transports are:
282 </para>
283 <variablelist>
284 <varlistentry>
285 <term>
286 <option>audit</option>
287 </term>
288 <listitem>
289 <para>for those read from the kernel audit subsystem
290 </para>
291 </listitem>
292 </varlistentry>
293
294 <varlistentry>
295 <term>
296 <option>driver</option>
297 </term>
298 <listitem>
299 <para>for internally generated messages
300 </para>
301 </listitem>
302 </varlistentry>
303
304 <varlistentry>
305 <term>
306 <option>syslog</option>
307 </term>
308 <listitem>
309 <para>for those received via the local syslog socket
310 with the syslog protocol
311 </para>
312 </listitem>
313 </varlistentry>
314
315 <varlistentry>
316 <term>
317 <option>journal</option>
318 </term>
319 <listitem>
320 <para>for those received via the native journal
321 protocol
322 </para>
323 </listitem>
324 </varlistentry>
325
326 <varlistentry>
327 <term>
328 <option>stdout</option>
329 </term>
330 <listitem>
331 <para>for those read from a service's standard output
332 or error output
333 </para>
334 </listitem>
335 </varlistentry>
336
337 <varlistentry>
338 <term>
339 <option>kernel</option>
340 </term>
341 <listitem>
342 <para>for those read from the kernel
343 </para>
344 </listitem>
345 </varlistentry>
346 </variablelist>
347 </listitem>
348 </varlistentry>
349 <varlistentry>
350 <term><varname>_STREAM_ID=</varname></term>
351 <listitem>
352 <para>Only applies to <literal>_TRANSPORT=stdout</literal> records: specifies a randomized 128bit ID assigned
353 to the stream connection when it was first created. This ID is useful to reconstruct individual log streams
354 from the log records: all log records carrying the same stream ID originate from the same stream.</para>
355 </listitem>
356 </varlistentry>
357 <varlistentry>
358 <term><varname>_LINE_BREAK=</varname></term>
359 <listitem>
360 <para>Only applies to <literal>_TRANSPORT=stdout</literal> records: indicates that the log message
361 in the standard output/error stream was not terminated with a normal newline character
362 (<literal>\n</literal>, i.e. ASCII 10). Specifically, when set this field is one of
363 <option>nul</option> (in case the line was terminated by a NUL byte), <option>line-max</option> (in
364 case the maximum log line length was reached, as configured with <varname>LineMax=</varname> in
365 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
366 <option>eof</option> (if this was the last log record of a stream and the stream ended without a
367 final newline character), or <option>pid-change</option> (if the process which generated the log
368 output changed in the middle of a line). Note that this record is not generated when a normal
369 newline character was used for marking the log line end.</para>
370 </listitem>
371 </varlistentry>
372 <varlistentry>
373 <term><varname>_NAMESPACE=</varname></term>
374
375 <listitem><para>If this file was written by a <command>systemd-journald</command> instance managing a
376 journal namespace that is not the default, this field contains the namespace identifier. See
377 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
378 for details about journal namespaces.</para>
379 </listitem>
380 </varlistentry>
381 </variablelist>
382 </refsect1>
383
384 <refsect1>
385 <title>Kernel Journal Fields</title>
386
387 <para>Kernel fields are fields that are used by messages
388 originating in the kernel and stored in the journal.</para>
389
390 <variablelist class='journal-directives'>
391 <varlistentry>
392 <term><varname>_KERNEL_DEVICE=</varname></term>
393 <listitem>
394 <para>The kernel device name. If the entry is associated to
395 a block device, the major and minor of the device node,
396 separated by <literal>:</literal> and prefixed by
397 <literal>b</literal>. Similar for character devices but
398 prefixed by <literal>c</literal>. For network devices, this
399 is the interface index prefixed by <literal>n</literal>. For
400 all other devices, this is the subsystem name prefixed by
401 <literal>+</literal>, followed by <literal>:</literal>,
402 followed by the kernel device name.</para>
403 </listitem>
404 </varlistentry>
405 <varlistentry>
406 <term><varname>_KERNEL_SUBSYSTEM=</varname></term>
407 <listitem>
408 <para>The kernel subsystem name.</para>
409 </listitem>
410 </varlistentry>
411 <varlistentry>
412 <term><varname>_UDEV_SYSNAME=</varname></term>
413 <listitem>
414 <para>The kernel device name as it shows up in the device
415 tree below <filename>/sys</filename>.</para>
416 </listitem>
417 </varlistentry>
418 <varlistentry>
419 <term><varname>_UDEV_DEVNODE=</varname></term>
420 <listitem>
421 <para>The device node path of this device in
422 <filename>/dev</filename>.</para>
423 </listitem>
424 </varlistentry>
425 <varlistentry>
426 <term><varname>_UDEV_DEVLINK=</varname></term>
427 <listitem>
428 <para>Additional symlink names pointing to the device node
429 in <filename>/dev</filename>. This field is frequently set
430 more than once per entry.</para>
431 </listitem>
432 </varlistentry>
433 </variablelist>
434 </refsect1>
435
436 <refsect1>
437 <title>Fields to log on behalf of a different program</title>
438
439 <para>Fields in this section are used by programs to specify that
440 they are logging on behalf of another program or unit.
441 </para>
442
443 <para>Fields used by the <command>systemd-coredump</command>
444 coredump kernel helper:
445 </para>
446
447 <variablelist class='journal-directives'>
448 <varlistentry>
449 <term><varname>COREDUMP_UNIT=</varname></term>
450 <term><varname>COREDUMP_USER_UNIT=</varname></term>
451 <listitem>
452 <para>Used to annotate messages containing coredumps from
453 system and session units. See
454 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
455 </para>
456 </listitem>
457 </varlistentry>
458 </variablelist>
459
460 <para>Privileged programs (currently UID 0) may attach
461 <varname>OBJECT_PID=</varname> to a message. This will instruct
462 <command>systemd-journald</command> to attach additional fields on
463 behalf of the caller:</para>
464
465 <variablelist class='journal-directives'>
466 <varlistentry>
467 <term><varname>OBJECT_PID=<replaceable>PID</replaceable></varname></term>
468 <listitem>
469 <para>PID of the program that this message pertains to.
470 </para>
471 </listitem>
472 </varlistentry>
473
474 <varlistentry>
475 <term><varname>OBJECT_UID=</varname></term>
476 <term><varname>OBJECT_GID=</varname></term>
477 <term><varname>OBJECT_COMM=</varname></term>
478 <term><varname>OBJECT_EXE=</varname></term>
479 <term><varname>OBJECT_CMDLINE=</varname></term>
480 <term><varname>OBJECT_AUDIT_SESSION=</varname></term>
481 <term><varname>OBJECT_AUDIT_LOGINUID=</varname></term>
482 <term><varname>OBJECT_SYSTEMD_CGROUP=</varname></term>
483 <term><varname>OBJECT_SYSTEMD_SESSION=</varname></term>
484 <term><varname>OBJECT_SYSTEMD_OWNER_UID=</varname></term>
485 <term><varname>OBJECT_SYSTEMD_UNIT=</varname></term>
486 <term><varname>OBJECT_SYSTEMD_USER_UNIT=</varname></term>
487 <listitem>
488 <para>These are additional fields added automatically by
489 <command>systemd-journald</command>. Their meaning is the
490 same as
491 <varname>_UID=</varname>,
492 <varname>_GID=</varname>,
493 <varname>_COMM=</varname>,
494 <varname>_EXE=</varname>,
495 <varname>_CMDLINE=</varname>,
496 <varname>_AUDIT_SESSION=</varname>,
497 <varname>_AUDIT_LOGINUID=</varname>,
498 <varname>_SYSTEMD_CGROUP=</varname>,
499 <varname>_SYSTEMD_SESSION=</varname>,
500 <varname>_SYSTEMD_UNIT=</varname>,
501 <varname>_SYSTEMD_USER_UNIT=</varname>, and
502 <varname>_SYSTEMD_OWNER_UID=</varname>
503 as described above, except that the process identified by
504 <replaceable>PID</replaceable> is described, instead of the
505 process which logged the message.</para>
506 </listitem>
507 </varlistentry>
508 </variablelist>
509
510 </refsect1>
511
512 <refsect1>
513 <title>Address Fields</title>
514
515 <para>During serialization into external formats, such as the
516 <ulink
517 url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal
518 Export Format</ulink> or the <ulink
519 url="https://www.freedesktop.org/wiki/Software/systemd/json">Journal
520 JSON Format</ulink>, the addresses of journal entries are
521 serialized into fields prefixed with double underscores. Note that
522 these are not proper fields when stored in the journal but for
523 addressing metadata of entries. They cannot be written as part of
524 structured log entries via calls such as
525 <citerefentry><refentrytitle>sd_journal_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
526 They may also not be used as matches for
527 <citerefentry><refentrytitle>sd_journal_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
528 </para>
529
530 <variablelist class='journal-directives'>
531 <varlistentry>
532 <term><varname>__CURSOR=</varname></term>
533 <listitem>
534 <para>The cursor for the entry. A cursor is an opaque text
535 string that uniquely describes the position of an entry in
536 the journal and is portable across machines, platforms and
537 journal files.
538 </para>
539 </listitem>
540 </varlistentry>
541
542 <varlistentry>
543 <term><varname>__REALTIME_TIMESTAMP=</varname></term>
544 <listitem>
545 <para>The wallclock time
546 (<constant>CLOCK_REALTIME</constant>) at the point in time
547 the entry was received by the journal, in microseconds since
548 the epoch UTC, formatted as a decimal string. This has
549 different properties from
550 <literal>_SOURCE_REALTIME_TIMESTAMP=</literal>, as it is
551 usually a bit later but more likely to be monotonic.
552 </para>
553 </listitem>
554 </varlistentry>
555
556 <varlistentry>
557 <term><varname>__MONOTONIC_TIMESTAMP=</varname></term>
558 <listitem>
559 <para>The monotonic time
560 (<constant>CLOCK_MONOTONIC</constant>) at the point in time
561 the entry was received by the journal in microseconds,
562 formatted as a decimal string. To be useful as an address
563 for the entry, this should be combined with the boot ID in
564 <literal>_BOOT_ID=</literal>.
565 </para>
566 </listitem>
567 </varlistentry>
568 </variablelist>
569 </refsect1>
570
571 <refsect1>
572 <title>See Also</title>
573 <para>
574 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
575 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
576 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
577 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
578 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
579 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
580 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
581 </para>
582 </refsect1>
583
584 </refentry>