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