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