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