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