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