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