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