]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.journal-fields.xml
travis: add more ASan options
[thirdparty/systemd.git] / man / systemd.journal-fields.xml
CommitLineData
ffa16db0 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
0307f791 4<!-- SPDX-License-Identifier: LGPL-2.1+ -->
ffa16db0
LP
5
6<refentry id="systemd.journal-fields">
7
798d3a52
ZJS
8 <refentryinfo>
9 <title>systemd.journal-fields</title>
10 <productname>systemd</productname>
798d3a52
ZJS
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 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>
34 </refsect1>
35
36 <refsect1>
37 <title>User Journal Fields</title>
38
39 <para>User fields are fields that are directly passed from clients
40 and stored in the journal.</para>
41
42 <variablelist class='journal-directives'>
43 <varlistentry>
44 <term><varname>MESSAGE=</varname></term>
45 <listitem>
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
dd2b607b 49 not supposed to be parsed for metadata.</para>
798d3a52
ZJS
50 </listitem>
51 </varlistentry>
52
53 <varlistentry>
54 <term><varname>MESSAGE_ID=</varname></term>
55 <listitem>
b9d016d6
LP
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>.
798d3a52
ZJS
60 </para>
61 </listitem>
62 </varlistentry>
63
64 <varlistentry>
65 <term><varname>PRIORITY=</varname></term>
66 <listitem>
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
70 concept.</para>
71 </listitem>
72 </varlistentry>
73
74 <varlistentry>
75 <term><varname>CODE_FILE=</varname></term>
76 <term><varname>CODE_LINE=</varname></term>
77 <term><varname>CODE_FUNC=</varname></term>
78 <listitem>
79 <para>The code location generating this message, if known.
80 Contains the source filename, the line number and the
81 function name.</para>
82 </listitem>
83 </varlistentry>
84
85 <varlistentry>
86 <term><varname>ERRNO=</varname></term>
87 <listitem>
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>
92 </listitem>
93 </varlistentry>
94
95 <varlistentry>
96 <term><varname>SYSLOG_FACILITY=</varname></term>
97 <term><varname>SYSLOG_IDENTIFIER=</varname></term>
98 <term><varname>SYSLOG_PID=</varname></term>
7c30c3c4 99 <term><varname>SYSLOG_TIMESTAMP=</varname></term>
798d3a52 100 <listitem>
7c30c3c4
ZJS
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
3ba3a79d 106 <citerefentry project='die-net'><refentrytitle>program_invocation_short_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>.)</para>
63ea8032
JS
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>
798d3a52 112 </listitem>
df8701a3 113 </varlistentry>
798d3a52 114
df8701a3
ZJS
115 <varlistentry>
116 <term><varname>SYSLOG_RAW=</varname></term>
117 <listitem>
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>
7c30c3c4
ZJS
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
df8701a3
ZJS
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
7c30c3c4
ZJS
128 based on the stored priority and facility, timestamp, identifier, and the
129 message payload in <varname>MESSAGE=</varname>.
130 </para>
df8701a3 131 </listitem>
798d3a52
ZJS
132 </varlistentry>
133 </variablelist>
134 </refsect1>
135
136 <refsect1>
137 <title>Trusted Journal Fields</title>
138
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>
142
143 <variablelist class='journal-directives'>
144 <varlistentry>
145 <term><varname>_PID=</varname></term>
146 <term><varname>_UID=</varname></term>
147 <term><varname>_GID=</varname></term>
148 <listitem>
149 <para>The process, user, and group ID of the process the
150 journal entry originates from formatted as a decimal
a96f668e
MK
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>
798d3a52
ZJS
154 </listitem>
155 </varlistentry>
156
157 <varlistentry>
158 <term><varname>_COMM=</varname></term>
159 <term><varname>_EXE=</varname></term>
160 <term><varname>_CMDLINE=</varname></term>
161 <listitem>
162 <para>The name, the executable path, and the command line of
163 the process the journal entry originates from.</para>
164 </listitem>
165 </varlistentry>
166
167 <varlistentry>
168 <term><varname>_CAP_EFFECTIVE=</varname></term>
169 <listitem>
170 <para>The effective
171 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
172 of the process the journal entry originates from.</para>
173 </listitem>
174 </varlistentry>
175
176 <varlistentry>
177 <term><varname>_AUDIT_SESSION=</varname></term>
178 <term><varname>_AUDIT_LOGINUID=</varname></term>
179 <listitem>
180 <para>The session and login UID of the process the journal
181 entry originates from, as maintained by the kernel audit
182 subsystem.</para>
183 </listitem>
184 </varlistentry>
185
186 <varlistentry>
187 <term><varname>_SYSTEMD_CGROUP=</varname></term>
fa93fe9c 188 <term><varname>_SYSTEMD_SLICE=</varname></term>
798d3a52
ZJS
189 <term><varname>_SYSTEMD_UNIT=</varname></term>
190 <term><varname>_SYSTEMD_USER_UNIT=</varname></term>
fa93fe9c 191 <term><varname>_SYSTEMD_SESSION=</varname></term>
798d3a52 192 <term><varname>_SYSTEMD_OWNER_UID=</varname></term>
798d3a52
ZJS
193
194 <listitem>
195 <para>The control group path in the systemd hierarchy, the
fa93fe9c
AJ
196 the systemd slice unit name, the systemd unit name, the
197 unit name in the systemd user manager (if any), the systemd
198 session ID (if any), and the owner UID of the systemd user
199 unit or systemd session (if any) of the process the journal
200 entry originates from.</para>
798d3a52
ZJS
201 </listitem>
202 </varlistentry>
203
204 <varlistentry>
205 <term><varname>_SELINUX_CONTEXT=</varname></term>
206 <listitem>
207 <para>The SELinux security context (label) of the process
208 the journal entry originates from.</para>
209 </listitem>
210 </varlistentry>
211
212 <varlistentry>
213 <term><varname>_SOURCE_REALTIME_TIMESTAMP=</varname></term>
214 <listitem>
215 <para>The earliest trusted timestamp of the message, if any
216 is known that is different from the reception time of the
217 journal. This is the time in microseconds since the epoch
218 UTC, formatted as a decimal string.</para>
219 </listitem>
220 </varlistentry>
221
222 <varlistentry>
223 <term><varname>_BOOT_ID=</varname></term>
224 <listitem>
225 <para>The kernel boot ID for the boot the message was
226 generated in, formatted as a 128-bit hexadecimal
227 string.</para>
228 </listitem>
229 </varlistentry>
230
231 <varlistentry>
232 <term><varname>_MACHINE_ID=</varname></term>
233 <listitem>
234 <para>The machine ID of the originating host, as available
235 in
236 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
237 </listitem>
238 </varlistentry>
239
dbb1d5cf
LW
240 <varlistentry>
241 <term><varname>_SYSTEMD_INVOCATION_ID=</varname></term>
242 <listitem>
243 <para>The invocation ID for the runtime cycle of the unit
244 the message was generated in, as available to processes
245 of the unit in <varname>$INVOCATION_ID</varname> (see
246 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>).</para>
247 </listitem>
248 </varlistentry>
249
798d3a52
ZJS
250 <varlistentry>
251 <term><varname>_HOSTNAME=</varname></term>
252 <listitem>
253 <para>The name of the originating host.</para>
254 </listitem>
255 </varlistentry>
256
257 <varlistentry>
258 <term><varname>_TRANSPORT=</varname></term>
259 <listitem>
260 <para>How the entry was received by the journal service.
261 Valid transports are:
262 </para>
263 <variablelist>
8983e16a
EV
264 <varlistentry>
265 <term>
266 <option>audit</option>
267 </term>
268 <listitem>
269 <para>for those read from the kernel audit subsystem
270 </para>
271 </listitem>
272 </varlistentry>
273
798d3a52
ZJS
274 <varlistentry>
275 <term>
276 <option>driver</option>
277 </term>
278 <listitem>
279 <para>for internally generated messages
5199cbe4 280 </para>
798d3a52
ZJS
281 </listitem>
282 </varlistentry>
283
284 <varlistentry>
285 <term>
286 <option>syslog</option>
287 </term>
288 <listitem>
289 <para>for those received via the local syslog socket
290 with the syslog protocol
53057ef9 291 </para>
798d3a52
ZJS
292 </listitem>
293 </varlistentry>
294
295 <varlistentry>
296 <term>
297 <option>journal</option>
298 </term>
299 <listitem>
300 <para>for those received via the native journal
301 protocol
302 </para>
303 </listitem>
304 </varlistentry>
305
306 <varlistentry>
307 <term>
308 <option>stdout</option>
309 </term>
310 <listitem>
311 <para>for those read from a service's standard output
312 or error output
313 </para>
314 </listitem>
315 </varlistentry>
316
317 <varlistentry>
318 <term>
319 <option>kernel</option>
320 </term>
321 <listitem>
322 <para>for those read from the kernel
323 </para>
324 </listitem>
325 </varlistentry>
326 </variablelist>
327 </listitem>
328 </varlistentry>
ec20fe5f
LP
329 <varlistentry>
330 <term><varname>_STREAM_ID=</varname></term>
331 <listitem>
ee8f5a58 332 <para>Only applies to <literal>_TRANSPORT=stdout</literal> records: specifies a randomized 128bit ID assigned
ec20fe5f
LP
333 to the stream connection when it was first created. This ID is useful to reconstruct individual log streams
334 from the log records: all log records carrying the same stream ID originate from the same stream.</para>
335 </listitem>
336 </varlistentry>
337 <varlistentry>
338 <term><varname>_LINE_BREAK=</varname></term>
339 <listitem>
ee8f5a58 340 <para>Only applies to <literal>_TRANSPORT=stdout</literal> records: indicates that the log message in the
ec20fe5f
LP
341 standard output/error stream was not terminated with a normal newline character (<literal>\n</literal>,
342 i.e. ASCII 10). Specifically, when set this field is one of <option>nul</option> (in case the line was
343 terminated by a NUL byte), <option>line-max</option> (in case the maximum log line length was reached, as
344 configured with <varname>LineMax=</varname> in
345 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>) or
346 <option>eof</option> (if this was the last log record of a stream and the stream ended without a final
347 newline character). Note that this record is not generated when a normal newline character was used for
348 marking the log line end.</para>
349 </listitem>
350 </varlistentry>
798d3a52
ZJS
351 </variablelist>
352 </refsect1>
353
354 <refsect1>
355 <title>Kernel Journal Fields</title>
356
357 <para>Kernel fields are fields that are used by messages
358 originating in the kernel and stored in the journal.</para>
359
360 <variablelist class='journal-directives'>
361 <varlistentry>
362 <term><varname>_KERNEL_DEVICE=</varname></term>
363 <listitem>
364 <para>The kernel device name. If the entry is associated to
365 a block device, the major and minor of the device node,
366 separated by <literal>:</literal> and prefixed by
367 <literal>b</literal>. Similar for character devices but
368 prefixed by <literal>c</literal>. For network devices, this
369 is the interface index prefixed by <literal>n</literal>. For
370 all other devices, this is the subsystem name prefixed by
371 <literal>+</literal>, followed by <literal>:</literal>,
372 followed by the kernel device name.</para>
373 </listitem>
374 </varlistentry>
375 <varlistentry>
376 <term><varname>_KERNEL_SUBSYSTEM=</varname></term>
377 <listitem>
378 <para>The kernel subsystem name.</para>
379 </listitem>
380 </varlistentry>
381 <varlistentry>
382 <term><varname>_UDEV_SYSNAME=</varname></term>
383 <listitem>
384 <para>The kernel device name as it shows up in the device
385 tree below <filename>/sys</filename>.</para>
386 </listitem>
387 </varlistentry>
388 <varlistentry>
389 <term><varname>_UDEV_DEVNODE=</varname></term>
390 <listitem>
391 <para>The device node path of this device in
392 <filename>/dev</filename>.</para>
393 </listitem>
394 </varlistentry>
395 <varlistentry>
396 <term><varname>_UDEV_DEVLINK=</varname></term>
397 <listitem>
398 <para>Additional symlink names pointing to the device node
399 in <filename>/dev</filename>. This field is frequently set
400 more than once per entry.</para>
401 </listitem>
402 </varlistentry>
403 </variablelist>
404 </refsect1>
405
406 <refsect1>
407 <title>Fields to log on behalf of a different program</title>
408
409 <para>Fields in this section are used by programs to specify that
410 they are logging on behalf of another program or unit.
411 </para>
412
413 <para>Fields used by the <command>systemd-coredump</command>
414 coredump kernel helper:
415 </para>
416
417 <variablelist class='journal-directives'>
418 <varlistentry>
419 <term><varname>COREDUMP_UNIT=</varname></term>
420 <term><varname>COREDUMP_USER_UNIT=</varname></term>
421 <listitem>
422 <para>Used to annotate messages containing coredumps from
423 system and session units. See
424 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
425 </para>
426 </listitem>
427 </varlistentry>
428 </variablelist>
429
ff9b60f3 430 <para>Privileged programs (currently UID 0) may attach
798d3a52
ZJS
431 <varname>OBJECT_PID=</varname> to a message. This will instruct
432 <command>systemd-journald</command> to attach additional fields on
433 behalf of the caller:</para>
434
435 <variablelist class='journal-directives'>
436 <varlistentry>
437 <term><varname>OBJECT_PID=<replaceable>PID</replaceable></varname></term>
438 <listitem>
439 <para>PID of the program that this message pertains to.
440 </para>
441 </listitem>
442 </varlistentry>
443
444 <varlistentry>
445 <term><varname>OBJECT_UID=</varname></term>
446 <term><varname>OBJECT_GID=</varname></term>
447 <term><varname>OBJECT_COMM=</varname></term>
448 <term><varname>OBJECT_EXE=</varname></term>
449 <term><varname>OBJECT_CMDLINE=</varname></term>
450 <term><varname>OBJECT_AUDIT_SESSION=</varname></term>
451 <term><varname>OBJECT_AUDIT_LOGINUID=</varname></term>
452 <term><varname>OBJECT_SYSTEMD_CGROUP=</varname></term>
453 <term><varname>OBJECT_SYSTEMD_SESSION=</varname></term>
454 <term><varname>OBJECT_SYSTEMD_OWNER_UID=</varname></term>
455 <term><varname>OBJECT_SYSTEMD_UNIT=</varname></term>
456 <term><varname>OBJECT_SYSTEMD_USER_UNIT=</varname></term>
457 <listitem>
458 <para>These are additional fields added automatically by
459 <command>systemd-journald</command>. Their meaning is the
460 same as
461 <varname>_UID=</varname>,
462 <varname>_GID=</varname>,
463 <varname>_COMM=</varname>,
464 <varname>_EXE=</varname>,
465 <varname>_CMDLINE=</varname>,
466 <varname>_AUDIT_SESSION=</varname>,
467 <varname>_AUDIT_LOGINUID=</varname>,
468 <varname>_SYSTEMD_CGROUP=</varname>,
469 <varname>_SYSTEMD_SESSION=</varname>,
470 <varname>_SYSTEMD_UNIT=</varname>,
471 <varname>_SYSTEMD_USER_UNIT=</varname>, and
472 <varname>_SYSTEMD_OWNER_UID=</varname>
473 as described above, except that the process identified by
474 <replaceable>PID</replaceable> is described, instead of the
475 process which logged the message.</para>
476 </listitem>
477 </varlistentry>
478 </variablelist>
479
798d3a52
ZJS
480 </refsect1>
481
482 <refsect1>
483 <title>Address Fields</title>
484
485 <para>During serialization into external formats, such as the
486 <ulink
28a0ad81 487 url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal
798d3a52 488 Export Format</ulink> or the <ulink
28a0ad81 489 url="https://www.freedesktop.org/wiki/Software/systemd/json">Journal
798d3a52
ZJS
490 JSON Format</ulink>, the addresses of journal entries are
491 serialized into fields prefixed with double underscores. Note that
492 these are not proper fields when stored in the journal but for
493 addressing metadata of entries. They cannot be written as part of
494 structured log entries via calls such as
495 <citerefentry><refentrytitle>sd_journal_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
496 They may also not be used as matches for
497 <citerefentry><refentrytitle>sd_journal_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry></para>
498
499 <variablelist class='journal-directives'>
500 <varlistentry>
501 <term><varname>__CURSOR=</varname></term>
502 <listitem>
503 <para>The cursor for the entry. A cursor is an opaque text
504 string that uniquely describes the position of an entry in
505 the journal and is portable across machines, platforms and
506 journal files.
507 </para>
508 </listitem>
509 </varlistentry>
510
511 <varlistentry>
512 <term><varname>__REALTIME_TIMESTAMP=</varname></term>
513 <listitem>
514 <para>The wallclock time
515 (<constant>CLOCK_REALTIME</constant>) at the point in time
516 the entry was received by the journal, in microseconds since
517 the epoch UTC, formatted as a decimal string. This has
518 different properties from
519 <literal>_SOURCE_REALTIME_TIMESTAMP=</literal>, as it is
520 usually a bit later but more likely to be monotonic.
521 </para>
522 </listitem>
523 </varlistentry>
524
525 <varlistentry>
526 <term><varname>__MONOTONIC_TIMESTAMP=</varname></term>
527 <listitem>
528 <para>The monotonic time
529 (<constant>CLOCK_MONOTONIC</constant>) at the point in time
530 the entry was received by the journal in microseconds,
531 formatted as a decimal string. To be useful as an address
532 for the entry, this should be combined with the boot ID in
533 <literal>_BOOT_ID=</literal>.
534 </para>
535 </listitem>
536 </varlistentry>
537 </variablelist>
538 </refsect1>
539
540 <refsect1>
541 <title>See Also</title>
542 <para>
543 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
544 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
545 <citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
546 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
547 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
548 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
549 </para>
550 </refsect1>
ffa16db0
LP
551
552</refentry>