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