Debian Codegraph @

upstream/debian-trixie/man8/systemd-journald.service.8

raw
1 '\" t
2 .TH "SYSTEMD\-JOURNALD\&.SERVICE" "8" "" "systemd 257.13" "systemd-journald.service"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd-journald.service, systemd-journald.socket, systemd-journald-dev-log.socket, systemd-journald-audit.socket, [email protected], [email protected], [email protected], systemd-journald \- Journal service
24 .SH "SYNOPSIS"
25 .PP
26 .RS 4
27 systemd\-journald\&.service
28 .RE
29 .RS 4
30 systemd\-journald\&.socket
31 .RE
32 .RS 4
33 systemd\-journald\-dev\-log\&.socket
34 .RE
35 .RS 4
36 systemd\-journald\-audit\&.socket
37 .RE
38 .RS 4
39 systemd\-journald@\&.service
40 .RE
41 .RS 4
42 systemd\-journald@\&.socket
43 .RE
44 .RS 4
45 systemd\-journald\-varlink@\&.socket
46 .RE
47 .RS 4
48 /usr/lib/systemd/systemd\-journald
49 .RE
50 .SH "DESCRIPTION"
51 .PP
52 systemd\-journald
53 is a system service that collects and stores logging data\&. It creates and maintains structured, indexed journals based on logging information that is received from a variety of sources:
54 .sp
55 .RS 4
56 .ie n \{\
57 \h'-04'\(bu\h'+03'\c
58 .\}
59 .el \{\
60 .sp -1
61 .IP \(bu 2.3
62 .\}
63 Kernel log messages, via kmsg
64 .RE
65 .sp
66 .RS 4
67 .ie n \{\
68 \h'-04'\(bu\h'+03'\c
69 .\}
70 .el \{\
71 .sp -1
72 .IP \(bu 2.3
73 .\}
74 Simple system log messages, via the
75 libc
76 \fBsyslog\fR(3)
77 call
78 .RE
79 .sp
80 .RS 4
81 .ie n \{\
82 \h'-04'\(bu\h'+03'\c
83 .\}
84 .el \{\
85 .sp -1
86 .IP \(bu 2.3
87 .\}
88 Structured system log messages via the native Journal API, see
89 \fBsd_journal_print\fR(3)
90 and
91 \m[blue]\fBNative Journal Protocol\fR\m[]\&\s-2\u[1]\d\s+2
92 .RE
93 .sp
94 .RS 4
95 .ie n \{\
96 \h'-04'\(bu\h'+03'\c
97 .\}
98 .el \{\
99 .sp -1
100 .IP \(bu 2.3
101 .\}
102 Standard output and standard error of service units\&. For further details see below\&.
103 .RE
104 .sp
105 .RS 4
106 .ie n \{\
107 \h'-04'\(bu\h'+03'\c
108 .\}
109 .el \{\
110 .sp -1
111 .IP \(bu 2.3
112 .\}
113 Audit records, originating from the kernel audit subsystem
114 .RE
115 .PP
116 The daemon will implicitly collect numerous metadata fields for each log messages in a secure and unfakeable way\&. See
117 \fBsystemd.journal-fields\fR(7)
118 for more information about the collected metadata\&.
119 .PP
120 Log data collected by the journal is primarily text\-based but can also include binary data where necessary\&. Individual fields making up a log record stored in the journal may be up to 2⁶⁴\-1 bytes in size\&.
121 .PP
122 The journal service stores log data either persistently below
123 /var/log/journal
124 or in a volatile way below
125 /run/log/journal/
126 (in the latter case, it is lost at reboot)\&. By default, log data is stored persistently if
127 /var/log/journal/
128 exists during boot, with an implicit fallback to volatile storage otherwise\&. Use
129 \fIStorage=\fR
130 in
131 \fBjournald.conf\fR(5)
132 to configure where log data is placed, independently of the existence of
133 /var/log/journal/\&.
134 .PP
135 Note that journald will initially use volatile storage, until a call to
136 \fBjournalctl \-\-flush\fR
137 (or sending
138 \fBSIGUSR1\fR
139 to journald) will cause it to switch to persistent logging (under the conditions mentioned above)\&. This is done automatically on boot via
140 "systemd\-journal\-flush\&.service"\&.
141 .PP
142 On systems where
143 /var/log/journal/
144 does not exist yet but where persistent logging is desired (and the default
145 journald\&.conf
146 is used), it is sufficient to create the directory, and ensure it has the correct access modes and ownership:
147 .sp
148 .if n \{\
149 .RS 4
150 .\}
151 .nf
152 mkdir \-p /var/log/journal
153 systemd\-tmpfiles \-\-create \-\-prefix /var/log/journal
154 .fi
155 .if n \{\
156 .RE
157 .\}
158 .PP
159 See
160 \fBjournald.conf\fR(5)
161 for information about the configuration of this service\&.
162 .SH "STREAM LOGGING"
163 .PP
164 The systemd service manager invokes all service processes with standard output and standard error connected to the journal by default\&. This behaviour may be altered via the
165 \fIStandardOutput=\fR/\fIStandardError=\fR
166 unit file settings, see
167 \fBsystemd.exec\fR(5)
168 for details\&. The journal converts the log byte stream received this way into individual log records, splitting the stream at newline ("\en", ASCII
169 \fB10\fR) and
170 \fBNUL\fR
171 bytes\&.
172 .PP
173 If
174 systemd\-journald\&.service
175 is stopped, the stream connections associated with all services are terminated\&. Further writes to those streams by the service will result in
176 \fBEPIPE\fR
177 errors\&. In order to react gracefully in this case, it is recommended that programs logging to standard output/error ignore such errors\&. If the
178 \fBSIGPIPE\fR
179 UNIX signal handler is not blocked or turned off, such write attempts will also result in such process signals being generated, see
180 \fBsignal\fR(7)\&. To mitigate this issue, systemd service manager explicitly turns off the
181 \fBSIGPIPE\fR
182 signal for all invoked processes by default (this may be changed for each unit individually via the
183 \fIIgnoreSIGPIPE=\fR
184 option, see
185 \fBsystemd.exec\fR(5)
186 for details)\&. After the standard output/standard error streams have been terminated they may not be recovered until the services they are associated with are restarted\&. Note that during normal operation,
187 systemd\-journald\&.service
188 stores copies of the file descriptors for those streams in the service manager\&. If
189 systemd\-journald\&.service
190 is restarted using
191 \fBsystemctl restart\fR
192 or equivalent operation instead of a pair of separate
193 \fBsystemctl stop\fR
194 and
195 \fBsystemctl start\fR
196 commands (or equivalent operations), these stream connections are not terminated and survive the restart\&. It is thus safe to restart
197 systemd\-journald\&.service, but stopping it is not recommended\&.
198 .PP
199 Note that the log record metadata for records transferred via such standard output/error streams reflect the metadata of the peer the stream was originally created for\&. If the stream connection is passed on to other processes (such as further child processes forked off the main service process), the log records will not reflect their metadata, but will continue to describe the original process\&. This is different from the other logging transports listed above, which are inherently record based and where the metadata is always associated with the individual record\&.
200 .PP
201 In addition to the implicit standard output/error logging of services, stream logging is also available via the
202 \fBsystemd-cat\fR(1)
203 command line tool\&.
204 .PP
205 Currently, the number of parallel log streams
206 systemd\-journald
207 will accept is limited to 4096\&. When this limit is reached further log streams may be established but will receive
208 \fBEPIPE\fR
209 right from the beginning\&.
210 .SH "JOURNAL NAMESPACES"
211 .PP
212 Journal \*(Aqnamespaces\*(Aq are both a mechanism for logically isolating the log stream of projects consisting of one or more services from the rest of the system and a mechanism for improving performance\&. Multiple journal namespaces may exist simultaneously, each defining its own, independent log stream managed by its own instance of
213 \fBsystemd\-journald\fR\&. Namespaces are independent of each other, both in the data store and in the IPC interface\&. By default, only a single "default namespace exists, managed by
214 systemd\-journald\&.service
215 (and its associated socket units)\&. Additional namespaces are created by starting an instance of the
216 systemd\-journald@\&.service
217 service template\&. The instance name is the namespace identifier, which is a short string used for referencing the journal namespace\&. Service units may be assigned to a specific journal namespace through the
218 \fILogNamespace=\fR
219 unit file setting, see
220 \fBsystemd.exec\fR(5)
221 for details\&. The
222 \fB\-\-namespace=\fR
223 switch of
224 \fBjournalctl\fR(1)
225 may be used to view the log stream of a specific namespace\&. If the switch is not used the log stream of the default namespace is shown, i\&.e\&. log data from other namespaces is not visible\&.
226 .PP
227 Services associated with a specific log namespace may log via
228 \fBsyslog\fR(3), the native logging protocol of the journal and via stdout/stderr; the logging from all three transports is associated with the namespace\&.
229 .PP
230 By default, only the default namespace will collect kernel and audit log messages\&.
231 .PP
232 The
233 \fBsystemd\-journald\fR
234 instance of the default namespace is configured through
235 /etc/systemd/journald\&.conf
236 (see below), while the other instances are configured through
237 /etc/systemd/journald@\fINAMESPACE\fR\&.conf\&. The journal log data for the default namespace is placed in
238 /var/log/journal/\fIMACHINE_ID\fR
239 (see below) while the data for the other namespaces is located in
240 /var/log/journal/\fIMACHINE_ID\fR\&.\fINAMESPACE\fR\&.
241 .SH "SIGNALS"
242 .PP
243 SIGUSR1
244 .RS 4
245 Request that journal data from
246 /run/
247 is flushed to
248 /var/
249 in order to make it persistent (if this is enabled)\&. This must be used after
250 /var/
251 is mounted, as otherwise log data from
252 /run/
253 is never flushed to
254 /var/
255 regardless of the configuration\&. Use the
256 \fBjournalctl \-\-flush\fR
257 command to request flushing of the journal files, and wait for the operation to complete\&. See
258 \fBjournalctl\fR(1)
259 for details\&.
260 .sp
261 Added in version 186\&.
262 .RE
263 .PP
264 SIGUSR2
265 .RS 4
266 Request immediate rotation of the journal files\&. Use the
267 \fBjournalctl \-\-rotate\fR
268 command to request journal file rotation, and wait for the operation to complete\&.
269 .sp
270 Added in version 186\&.
271 .RE
272 .PP
273 SIGRTMIN+1
274 .RS 4
275 Request that all unwritten log data is written to disk\&. Use the
276 \fBjournalctl \-\-sync\fR
277 command to trigger journal synchronization, and wait for the operation to complete\&.
278 .sp
279 Added in version 228\&.
280 .RE
281 .SH "CREDENTIALS"
282 .PP
283 \fBsystemd\-journald\fR
284 supports the service credentials logic as implemented by
285 \fIImportCredential=\fR/\fILoadCredential=\fR/\fISetCredential=\fR
286 (see
287 \fBsystemd.exec\fR(5)
288 for details)\&. The following credentials are used when passed in:
289 .PP
290 \fIjournal\&.forward_to_socket\fR
291 .RS 4
292 May contain a socket address to which logs should be forwarded\&. See
293 \fIForwardToSocket=\fR
294 in
295 \fBjournald.conf\fR(5)\&.
296 .sp
297 Added in version 256\&.
298 .RE
299 .PP
300 \fIjournal\&.storage\fR
301 .RS 4
302 May be used to specify where journal files should be stored\&. See
303 \fIStorage=\fR
304 in
305 \fBjournald.conf\fR(5)\&.
306 .sp
307 Added in version 256\&.
308 .RE
309 .SH "KERNEL COMMAND LINE"
310 .PP
311 A few configuration parameters from
312 journald\&.conf
313 may be overridden on the kernel command line:
314 .PP
315 \fIsystemd\&.journald\&.forward_to_syslog=\fR, \fIsystemd\&.journald\&.forward_to_kmsg=\fR, \fIsystemd\&.journald\&.forward_to_console=\fR, \fIsystemd\&.journald\&.forward_to_wall=\fR
316 .RS 4
317 Enables/disables forwarding of collected log messages to syslog, the kernel log buffer, the system console or wall\&.
318 .sp
319 See
320 \fBjournald.conf\fR(5)
321 for information about these settings\&.
322 .sp
323 Added in version 186\&.
324 .RE
325 .PP
326 \fIsystemd\&.journald\&.max_level_store=\fR, \fIsystemd\&.journald\&.max_level_syslog=\fR, \fIsystemd\&.journald\&.max_level_kmsg=\fR, \fIsystemd\&.journald\&.max_level_console=\fR, \fIsystemd\&.journald\&.max_level_wall=\fR, \fIsystemd\&.journald\&.max_level_socket=\fR
327 .RS 4
328 Controls the maximum log level of messages that are stored in the journal, forwarded to
329 \fBsyslog\fR(3), kmsg, the console,
330 \fBwall\fR(1), or a socket\&. This kernel command line options override the settings of the same names in the
331 \fBjournald.conf\fR(5)
332 file\&.
333 .sp
334 Added in version 232\&.
335 .RE
336 .PP
337 Note that these kernel command line options are only honoured by the default namespace, see above\&.
338 .SH "ACCESS CONTROL"
339 .PP
340 Journal files are, by default, owned and readable by the
341 "systemd\-journal"
342 system group but are not writable\&. Adding a user to this group thus enables them to read the journal files\&.
343 .PP
344 By default, each user, with a UID outside the range of system users, dynamic service users, and the nobody user, will get their own set of journal files in
345 /var/log/journal/\&. See
346 \m[blue]\fBUsers, Groups, UIDs and GIDs on systemd systems\fR\m[]\&\s-2\u[2]\d\s+2
347 for more details about UID ranges\&. These journal files will not be owned by the user, however, in order to avoid that the user can write to them directly\&. Instead, file system ACLs are used to ensure the user gets read access only\&.
348 .PP
349 Additional users and groups may be granted access to journal files via file system access control lists (ACL)\&. Distributions and administrators may choose to grant read access to all members of the
350 "wheel"
351 and
352 "adm"
353 system groups with a command such as the following:
354 .sp
355 .if n \{\
356 .RS 4
357 .\}
358 .nf
359 # setfacl \-Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/
360 .fi
361 .if n \{\
362 .RE
363 .\}
364 .PP
365 Note that this command will update the ACLs both for existing journal files and for future journal files created in the
366 /var/log/journal/
367 directory\&.
368 .SH "FILES"
369 .PP
370 /etc/systemd/journald\&.conf
371 .RS 4
372 Configure
373 \fBsystemd\-journald\fR
374 behavior\&. See
375 \fBjournald.conf\fR(5)\&.
376 .sp
377 Added in version 206\&.
378 .RE
379 .PP
380 /run/log/journal/\fImachine\-id\fR/*\&.journal, /run/log/journal/\fImachine\-id\fR/*\&.journal~, /var/log/journal/\fImachine\-id\fR/*\&.journal, /var/log/journal/\fImachine\-id\fR/*\&.journal~
381 .RS 4
382 \fBsystemd\-journald\fR
383 writes entries to files in
384 /run/log/journal/\fImachine\-id\fR/
385 or
386 /var/log/journal/\fImachine\-id\fR/
387 with the
388 "\&.journal"
389 suffix\&. If the daemon is stopped uncleanly, or if the files are found to be corrupted, they are renamed using the
390 "\&.journal~"
391 suffix, and
392 \fBsystemd\-journald\fR
393 starts writing to a new file\&.
394 /run/
395 is used when
396 /var/log/journal
397 is not available, or when
398 \fBStorage=volatile\fR
399 is set in the
400 \fBjournald.conf\fR(5)
401 configuration file\&.
402 .sp
403 When
404 systemd\-journald
405 ceases writing to a journal file, it will be renamed to
406 "\fIoriginal\-name\fR@\fIsuffix\&.journal\fR"
407 (or
408 "\fIoriginal\-name\fR@\fIsuffix\&.journal~\fR")\&. Such files are "archived" and will not be written to any more\&.
409 .sp
410 In general, it is safe to read or copy any journal file (active or archived)\&.
411 \fBjournalctl\fR(1)
412 and the functions in the
413 \fBsd-journal\fR(3)
414 library should be able to read all entries that have been fully written\&.
415 .sp
416 systemd\-journald
417 will automatically remove the oldest archived journal files to limit disk use\&. See
418 \fISystemMaxUse=\fR
419 and related settings in
420 \fBjournald.conf\fR(5)\&.
421 .sp
422 Added in version 206\&.
423 .RE
424 .PP
425 /dev/kmsg, /dev/log, /run/systemd/journal/dev\-log, /run/systemd/journal/socket, /run/systemd/journal/stdout
426 .RS 4
427 Sockets and other file node paths that
428 \fBsystemd\-journald\fR
429 will listen on and are visible in the file system\&. In addition to these,
430 \fBsystemd\-journald\fR
431 can listen for audit events using
432 \fBnetlink\fR(7), depending on whether
433 "systemd\-journald\-audit\&.socket"
434 is enabled or not\&.
435 .sp
436 Added in version 228\&.
437 .RE
438 .PP
439 If journal namespacing is used these paths are slightly altered to include a namespace identifier, see above\&.
440 .SH "SEE ALSO"
441 .PP
442 \fBsystemd\fR(1), \fBjournalctl\fR(1), \fBjournald.conf\fR(5), \fBsystemd.journal-fields\fR(7), \fBsd-journal\fR(3), \fBsystemd-coredump\fR(8), \fBsetfacl\fR(1), \fBsd_journal_print\fR(3), \fBpydoc systemd\&.journal\fR
443 .SH "NOTES"
444 .IP " 1." 4
445 Native Journal Protocol
446 .RS 4
447 \%https://systemd.io/JOURNAL_NATIVE_PROTOCOL
448 .RE
449 .IP " 2." 4
450 Users, Groups, UIDs and GIDs on systemd systems
451 .RS 4
452 \%https://systemd.io/UIDS-GIDS
453 .RE