summaryrefslogtreecommitdiffstats
path: root/upstream/debian-bookworm/man7/systemd.journal-fields.7
blob: 9bd44b20c07367ba3d9dafe0d6ce190c6934f5ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
'\" t
.TH "SYSTEMD\&.JOURNAL\-FIELDS" "7" "" "systemd 254" "systemd.journal-fields"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd.journal-fields \- Special journal fields
.SH "DESCRIPTION"
.PP
Entries in the journal (as written by
\fBsystemd-journald.service\fR(8)) resemble a UNIX process environment block in syntax but with field values that may include binary data, and with non\-unique field names permitted\&. Primarily, field values are formatted UTF\-8 text strings \(em binary encoding is used only where formatting as UTF\-8 text strings makes little sense\&. New fields may freely be defined by applications, but a few fields have special meanings, which are listed below\&. Typically, fields may only appear once per log entry, however there are special exceptions: some fields may appear more than once per entry, in which case this is explicitly mentioned below\&. Even though the logging subsystem makes no restrictions on which fields to accept non\-unique values for, it is strongly recommended to avoid relying on this for the fields listed below (except where listed otherwise, as mentioned) in order to avoid unnecessary incompatibilities with other applications\&.
.SH "USER JOURNAL FIELDS"
.PP
User fields are fields that are directly passed from clients and stored in the journal\&.
.PP
\fIMESSAGE=\fR
.RS 4
The human\-readable message string for this entry\&. This is supposed to be the primary text shown to the user\&. It is usually not translated (but might be in some cases), and is not supposed to be parsed for metadata\&. In order to encode multiple lines in a single log entry, separate them by newline characters (ASCII code 10), but encode them as a single
\fIMESSAGE=\fR
field\&. Do not add multiple values of this field type to the same entry (also see above), as consuming applications generally do not expect this and are unlikely to show all values in that case\&.
.RE
.PP
\fIMESSAGE_ID=\fR
.RS 4
A 128\-bit message identifier ID for recognizing certain message types, if this is desirable\&. This should contain a 128\-bit ID formatted as a lower\-case hexadecimal string, without any separating dashes or suchlike\&. This is recommended to be a UUID\-compatible ID, but this is not enforced, and formatted differently\&. Developers can generate a new ID for this purpose with
\fBsystemd\-id128 new\fR\&.
.RE
.PP
\fIPRIORITY=\fR
.RS 4
A priority value between 0 ("emerg") and 7 ("debug") formatted as a decimal string\&. This field is compatible with syslog\*(Aqs priority concept\&.
.RE
.PP
\fICODE_FILE=\fR, \fICODE_LINE=\fR, \fICODE_FUNC=\fR
.RS 4
The code location generating this message, if known\&. Contains the source filename, the line number and the function name\&.
.RE
.PP
\fIERRNO=\fR
.RS 4
The low\-level Unix error number causing this entry, if any\&. Contains the numeric value of
\fBerrno\fR(3)
formatted as a decimal string\&.
.RE
.PP
\fIINVOCATION_ID=\fR, \fIUSER_INVOCATION_ID=\fR
.RS 4
A randomized, unique 128\-bit ID identifying each runtime cycle of the unit\&. This is different from
\fI_SYSTEMD_INVOCATION_ID\fR
in that it is only used for messages coming from systemd code (e\&.g\&. logs from the system/user manager or from forked processes performing systemd\-related setup)\&.
.RE
.PP
\fISYSLOG_FACILITY=\fR, \fISYSLOG_IDENTIFIER=\fR, \fISYSLOG_PID=\fR, \fISYSLOG_TIMESTAMP=\fR
.RS 4
Syslog compatibility fields containing the facility (formatted as decimal string), the identifier string (i\&.e\&. "tag"), the client PID, and the timestamp as specified in the original datagram\&. (Note that the tag is usually derived from glibc\*(Aqs
\fIprogram_invocation_short_name\fR
variable, see
\fBprogram_invocation_short_name\fR(3)\&.)
.sp
Note that the journal service does not validate the values of any structured journal fields whose name is not prefixed with an underscore, and this includes any syslog related fields such as these\&. Hence, applications that supply a facility, PID, or log level are expected to do so properly formatted, i\&.e\&. as numeric integers formatted as decimal strings\&.
.RE
.PP
\fISYSLOG_RAW=\fR
.RS 4
The original contents of the syslog line as received in the syslog datagram\&. This field is only included if the
\fIMESSAGE=\fR
field was modified compared to the original payload or the timestamp could not be located properly and is not included in
\fISYSLOG_TIMESTAMP=\fR\&. Message truncation occurs when the message contains leading or trailing whitespace (trailing and leading whitespace is stripped), or it contains an embedded
\fBNUL\fR
byte (the
\fBNUL\fR
byte and anything after it is not included)\&. Thus, the original syslog line is either stored as
\fISYSLOG_RAW=\fR
or it can be recreated based on the stored priority and facility, timestamp, identifier, and the message payload in
\fIMESSAGE=\fR\&.
.RE
.PP
\fIDOCUMENTATION=\fR
.RS 4
A documentation URL with further information about the topic of the log message\&. Tools such as
\fBjournalctl\fR
will include a hyperlink to a URL specified this way in their output\&. Should be an
"http://",
"https://",
"file:/",
"man:"
or
"info:"
URL\&.
.RE
.PP
\fITID=\fR
.RS 4
The numeric thread ID (TID) the log message originates from\&.
.RE
.PP
\fIUNIT=\fR, \fIUSER_UNIT=\fR
.RS 4
The name of a unit\&. Used by the system and user managers when logging about specific units\&.
.sp
When
\fB\-\-unit=\fR\fB\fIname\fR\fR
or
\fB\-\-user\-unit=\fR\fB\fIname\fR\fR
are used with
\fBjournalctl\fR(1), a match pattern that includes
"UNIT=\fIname\fR\&.service"
or
"USER_UNIT=\fIname\fR\&.service"
will be generated\&.
.RE
.SH "TRUSTED JOURNAL FIELDS"
.PP
Fields prefixed with an underscore are trusted fields, i\&.e\&. fields that are implicitly added by the journal and cannot be altered by client code\&.
.PP
\fI_PID=\fR, \fI_UID=\fR, \fI_GID=\fR
.RS 4
The process, user, and group ID of the process the journal entry originates from formatted as a decimal string\&. Note that entries obtained via
"stdout"
or
"stderr"
of forked processes will contain credentials valid for a parent process (that initiated the connection to
\fBsystemd\-journald\fR)\&.
.RE
.PP
\fI_COMM=\fR, \fI_EXE=\fR, \fI_CMDLINE=\fR
.RS 4
The name, the executable path, and the command line of the process the journal entry originates from\&.
.RE
.PP
\fI_CAP_EFFECTIVE=\fR
.RS 4
The effective
\fBcapabilities\fR(7)
of the process the journal entry originates from\&.
.RE
.PP
\fI_AUDIT_SESSION=\fR, \fI_AUDIT_LOGINUID=\fR
.RS 4
The session and login UID of the process the journal entry originates from, as maintained by the kernel audit subsystem\&.
.RE
.PP
\fI_SYSTEMD_CGROUP=\fR, \fI_SYSTEMD_SLICE=\fR, \fI_SYSTEMD_UNIT=\fR, \fI_SYSTEMD_USER_UNIT=\fR, \fI_SYSTEMD_USER_SLICE=\fR, \fI_SYSTEMD_SESSION=\fR, \fI_SYSTEMD_OWNER_UID=\fR
.RS 4
The control group path in the systemd hierarchy, the systemd slice unit name, the systemd unit name, the unit name in the systemd user manager (if any), the systemd session ID (if any), and the owner UID of the systemd user unit or systemd session (if any) of the process the journal entry originates from\&.
.RE
.PP
\fI_SELINUX_CONTEXT=\fR
.RS 4
The SELinux security context (label) of the process the journal entry originates from\&.
.RE
.PP
\fI_SOURCE_REALTIME_TIMESTAMP=\fR
.RS 4
The earliest trusted timestamp of the message, if any is known that is different from the reception time of the journal\&. This is the time in microseconds since the epoch UTC, formatted as a decimal string\&.
.RE
.PP
\fI_BOOT_ID=\fR
.RS 4
The kernel boot ID for the boot the message was generated in, formatted as a 128\-bit hexadecimal string\&.
.RE
.PP
\fI_MACHINE_ID=\fR
.RS 4
The machine ID of the originating host, as available in
\fBmachine-id\fR(5)\&.
.RE
.PP
\fI_SYSTEMD_INVOCATION_ID=\fR
.RS 4
The invocation ID for the runtime cycle of the unit the message was generated in, as available to processes of the unit in
\fI$INVOCATION_ID\fR
(see
\fBsystemd.exec\fR(5))\&.
.RE
.PP
\fI_HOSTNAME=\fR
.RS 4
The name of the originating host\&.
.RE
.PP
\fI_TRANSPORT=\fR
.RS 4
How the entry was received by the journal service\&. Valid transports are:
.PP
\fBaudit\fR
.RS 4
for those read from the kernel audit subsystem
.RE
.PP
\fBdriver\fR
.RS 4
for internally generated messages
.RE
.PP
\fBsyslog\fR
.RS 4
for those received via the local syslog socket with the syslog protocol
.RE
.PP
\fBjournal\fR
.RS 4
for those received via the native journal protocol
.RE
.PP
\fBstdout\fR
.RS 4
for those read from a service\*(Aqs standard output or error output
.RE
.PP
\fBkernel\fR
.RS 4
for those read from the kernel
.RE
.RE
.PP
\fI_STREAM_ID=\fR
.RS 4
Only applies to
"_TRANSPORT=stdout"
records: specifies a randomized 128\-bit ID assigned to the stream connection when it was first created\&. This ID is useful to reconstruct individual log streams from the log records: all log records carrying the same stream ID originate from the same stream\&.
.RE
.PP
\fI_LINE_BREAK=\fR
.RS 4
Only applies to
"_TRANSPORT=stdout"
records: indicates that the log message in the standard output/error stream was not terminated with a normal newline character ("\en", i\&.e\&. ASCII 10)\&. Specifically, when set this field is one of
\fBnul\fR
(in case the line was terminated by a
\fBNUL\fR
byte),
\fBline\-max\fR
(in case the maximum log line length was reached, as configured with
\fILineMax=\fR
in
\fBjournald.conf\fR(5)),
\fBeof\fR
(if this was the last log record of a stream and the stream ended without a final newline character), or
\fBpid\-change\fR
(if the process which generated the log output changed in the middle of a line)\&. Note that this record is not generated when a normal newline character was used for marking the log line end\&.
.RE
.PP
\fI_NAMESPACE=\fR
.RS 4
If this file was written by a
\fBsystemd\-journald\fR
instance managing a journal namespace that is not the default, this field contains the namespace identifier\&. See
\fBsystemd-journald.service\fR(8)
for details about journal namespaces\&.
.RE
.PP
\fI_RUNTIME_SCOPE=\fR
.RS 4
A string field that specifies the runtime scope in which the message was logged\&. If
"initrd", the log message was processed while the system was running inside the initrd\&. If
"system", the log message was generated after the system switched execution to the host root filesystem\&.
.RE
.SH "KERNEL JOURNAL FIELDS"
.PP
Kernel fields are fields that are used by messages originating in the kernel and stored in the journal\&.
.PP
\fI_KERNEL_DEVICE=\fR
.RS 4
The kernel device name\&. If the entry is associated to a block device, contains the major and minor numbers of the device node, separated by
":"
and prefixed by
"b"\&. Similarly for character devices, but prefixed by
"c"\&. For network devices, this is the interface index prefixed by
"n"\&. For all other devices, this is the subsystem name prefixed by
"+", followed by
":", followed by the kernel device name\&.
.RE
.PP
\fI_KERNEL_SUBSYSTEM=\fR
.RS 4
The kernel subsystem name\&.
.RE
.PP
\fI_UDEV_SYSNAME=\fR
.RS 4
The kernel device name as it shows up in the device tree below
/sys/\&.
.RE
.PP
\fI_UDEV_DEVNODE=\fR
.RS 4
The device node path of this device in
/dev/\&.
.RE
.PP
\fI_UDEV_DEVLINK=\fR
.RS 4
Additional symlink names pointing to the device node in
/dev/\&. This field is frequently set more than once per entry\&.
.RE
.SH "FIELDS TO LOG ON BEHALF OF A DIFFERENT PROGRAM"
.PP
Fields in this section are used by programs to specify that they are logging on behalf of another program or unit\&.
.PP
Fields used by the
\fBsystemd\-coredump\fR
coredump kernel helper:
.PP
\fICOREDUMP_UNIT=\fR, \fICOREDUMP_USER_UNIT=\fR
.RS 4
Used to annotate messages containing coredumps from system and session units\&. See
\fBcoredumpctl\fR(1)\&.
.RE
.PP
Privileged programs (currently UID 0) may attach
\fIOBJECT_PID=\fR
to a message\&. This will instruct
\fBsystemd\-journald\fR
to attach additional fields on behalf of the caller:
.PP
\fIOBJECT_PID=\fR\fI\fIPID\fR\fR
.RS 4
PID of the program that this message pertains to\&.
.RE
.PP
\fIOBJECT_UID=\fR, \fIOBJECT_GID=\fR, \fIOBJECT_COMM=\fR, \fIOBJECT_EXE=\fR, \fIOBJECT_CMDLINE=\fR, \fIOBJECT_AUDIT_SESSION=\fR, \fIOBJECT_AUDIT_LOGINUID=\fR, \fIOBJECT_SYSTEMD_CGROUP=\fR, \fIOBJECT_SYSTEMD_SESSION=\fR, \fIOBJECT_SYSTEMD_OWNER_UID=\fR, \fIOBJECT_SYSTEMD_UNIT=\fR, \fIOBJECT_SYSTEMD_USER_UNIT=\fR
.RS 4
These are additional fields added automatically by
\fBsystemd\-journald\fR\&. Their meaning is the same as
\fI_UID=\fR,
\fI_GID=\fR,
\fI_COMM=\fR,
\fI_EXE=\fR,
\fI_CMDLINE=\fR,
\fI_AUDIT_SESSION=\fR,
\fI_AUDIT_LOGINUID=\fR,
\fI_SYSTEMD_CGROUP=\fR,
\fI_SYSTEMD_SESSION=\fR,
\fI_SYSTEMD_UNIT=\fR,
\fI_SYSTEMD_USER_UNIT=\fR, and
\fI_SYSTEMD_OWNER_UID=\fR
as described above, except that the process identified by
\fIPID\fR
is described, instead of the process which logged the message\&.
.RE
.SH "ADDRESS FIELDS"
.PP
During serialization into external formats, such as the
\m[blue]\fBJournal Export Format\fR\m[]\&\s-2\u[1]\d\s+2
or the
\m[blue]\fBJournal JSON Format\fR\m[]\&\s-2\u[2]\d\s+2, the addresses of journal entries are serialized into fields prefixed with double underscores\&. Note that these are not proper fields when stored in the journal but for addressing metadata of entries\&. They cannot be written as part of structured log entries via calls such as
\fBsd_journal_send\fR(3)\&. They may also not be used as matches for
\fBsd_journal_add_match\fR(3)\&.
.PP
\fI__CURSOR=\fR
.RS 4
The cursor for the entry\&. A cursor is an opaque text string that uniquely describes the position of an entry in the journal and is portable across machines, platforms and journal files\&.
.RE
.PP
\fI__REALTIME_TIMESTAMP=\fR
.RS 4
The wallclock time (\fBCLOCK_REALTIME\fR) at the point in time the entry was received by the journal, in microseconds since the epoch UTC, formatted as a decimal string\&. This has different properties from
"_SOURCE_REALTIME_TIMESTAMP=", as it is usually a bit later but more likely to be monotonic\&.
.RE
.PP
\fI__MONOTONIC_TIMESTAMP=\fR
.RS 4
The monotonic time (\fBCLOCK_MONOTONIC\fR) at the point in time the entry was received by the journal in microseconds, formatted as a decimal string\&. To be useful as an address for the entry, this should be combined with the boot ID in
"_BOOT_ID="\&.
.RE
.PP
\fI__SEQNUM=\fR, \fI__SEQNUM_ID=\fR
.RS 4
The sequence number (and associated sequence number ID) of this journal entry in the journal file it originates from\&. See
\fBsd_journal_get_seqnum\fR(3)
for details\&.
.RE
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd-journald.service\fR(8),
\fBjournalctl\fR(1),
\fBjournald.conf\fR(5),
\fBsd-journal\fR(3),
\fBcoredumpctl\fR(1),
\fBsystemd.directives\fR(7)
.SH "NOTES"
.IP " 1." 4
Journal Export Format
.RS 4
\%https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format
.RE
.IP " 2." 4
Journal JSON Format
.RS 4
\%https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format
.RE