Debian Codegraph @

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

raw
1 '\" t
2 .TH "SYSTEMD\-JOURNALD\&.SERVICE" "8" "" "systemd 261~rc3" "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 .PP
282 SIGHUP
283 .RS 4
284 Upon reception of the
285 \fBSIGHUP\fR
286 process signal
287 \fBsystemd\-journald\fR
288 will reload its configuration values and update the kernel log buffer and journals to reflect the new configuration\&. If
289 \fIReadKmsg=\fR
290 has changed, the kernel log buffer will be flushed and updated as part of the reload\&. The active journal (e\&.g\&., persistent, volatile) will continue to be used with the updated configuration\&. However, if the storage mode has changed from persistent to volatile and the current journal in use is the persistent journal, then the active journal will be switched to the volatile journal\&.
291 .sp
292 Added in version 258\&.
293 .RE
294 .SH "CREDENTIALS"
295 .PP
296 \fBsystemd\-journald\fR
297 supports the service credentials logic as implemented by
298 \fIImportCredential=\fR/\fILoadCredential=\fR/\fISetCredential=\fR
299 (see
300 \fBsystemd.exec\fR(5)
301 for details)\&. The following credentials are used when passed in:
302 .PP
303 \fIjournal\&.forward_to_socket\fR
304 .RS 4
305 May contain a socket address to which logs should be forwarded\&. See
306 \fIForwardToSocket=\fR
307 in
308 \fBjournald.conf\fR(5)\&.
309 .sp
310 Added in version 256\&.
311 .RE
312 .PP
313 \fIjournal\&.storage\fR
314 .RS 4
315 May be used to specify where journal files should be stored\&. See
316 \fIStorage=\fR
317 in
318 \fBjournald.conf\fR(5)\&.
319 .sp
320 Added in version 256\&.
321 .RE
322 .SH "KERNEL COMMAND LINE"
323 .PP
324 A few configuration parameters from
325 journald\&.conf
326 may be overridden on the kernel command line:
327 .PP
328 \fIsystemd\&.journald\&.forward_to_syslog=\fR, \fIsystemd\&.journald\&.forward_to_kmsg=\fR, \fIsystemd\&.journald\&.forward_to_console=\fR, \fIsystemd\&.journald\&.forward_to_wall=\fR
329 .RS 4
330 Enables/disables forwarding of collected log messages to syslog, the kernel log buffer, the system console or wall\&.
331 .sp
332 See
333 \fBjournald.conf\fR(5)
334 for information about these settings\&.
335 .sp
336 Added in version 186\&.
337 .RE
338 .PP
339 \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
340 .RS 4
341 Controls the maximum log level of messages that are stored in the journal, forwarded to
342 \fBsyslog\fR(3), kmsg, the console,
343 \fBwall\fR(1), or a socket\&. This kernel command line options override the settings of the same names in the
344 \fBjournald.conf\fR(5)
345 file\&.
346 .sp
347 Added in version 232\&.
348 .RE
349 .PP
350 Note that these kernel command line options are only honoured by the default namespace, see above\&.
351 .SH "ACCESS CONTROL"
352 .PP
353 Journal files are, by default, owned and readable by the
354 "systemd\-journal"
355 system group but are not writable\&. Adding a user to this group thus enables them to read the journal files\&.
356 .PP
357 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
358 /var/log/journal/\&. See
359 \m[blue]\fBUsers, Groups, UIDs and GIDs on systemd systems\fR\m[]\&\s-2\u[2]\d\s+2
360 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\&.
361 .PP
362 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
363 "wheel"
364 and
365 "adm"
366 system groups with a command such as the following:
367 .sp
368 .if n \{\
369 .RS 4
370 .\}
371 .nf
372 # setfacl \-Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/
373 .fi
374 .if n \{\
375 .RE
376 .\}
377 .PP
378 Note that this command will update the ACLs both for existing journal files and for future journal files created in the
379 /var/log/journal/
380 directory\&.
381 .SH "FILES"
382 .PP
383 /etc/systemd/journald\&.conf
384 .RS 4
385 Configure
386 \fBsystemd\-journald\fR
387 behavior\&. See
388 \fBjournald.conf\fR(5)\&.
389 .sp
390 Added in version 206\&.
391 .RE
392 .PP
393 /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~
394 .RS 4
395 \fBsystemd\-journald\fR
396 writes entries to files in
397 /run/log/journal/\fImachine\-id\fR/
398 or
399 /var/log/journal/\fImachine\-id\fR/
400 with the
401 "\&.journal"
402 suffix\&. If the daemon is stopped uncleanly, or if the files are found to be corrupted, they are renamed using the
403 "\&.journal~"
404 suffix, and
405 \fBsystemd\-journald\fR
406 starts writing to a new file\&.
407 /run/
408 is used when
409 /var/log/journal
410 is not available, or when
411 \fBStorage=volatile\fR
412 is set in the
413 \fBjournald.conf\fR(5)
414 configuration file\&.
415 .sp
416 When
417 systemd\-journald
418 ceases writing to a journal file, it will be renamed to
419 "\fIoriginal\-name\fR@\fIsuffix\&.journal\fR"
420 (or
421 "\fIoriginal\-name\fR@\fIsuffix\&.journal~\fR")\&. Such files are "archived" and will not be written to any more\&.
422 .sp
423 In general, it is safe to read or copy any journal file (active or archived)\&.
424 \fBjournalctl\fR(1)
425 and the functions in the
426 \fBsd-journal\fR(3)
427 library should be able to read all entries that have been fully written\&.
428 .sp
429 systemd\-journald
430 will automatically remove the oldest archived journal files to limit disk use\&. See
431 \fISystemMaxUse=\fR
432 and related settings in
433 \fBjournald.conf\fR(5)\&.
434 .sp
435 Added in version 206\&.
436 .RE
437 .PP
438 /dev/kmsg, /dev/log, /run/systemd/journal/dev\-log, /run/systemd/journal/socket, /run/systemd/journal/stdout
439 .RS 4
440 Sockets and other file node paths that
441 \fBsystemd\-journald\fR
442 will listen on and are visible in the file system\&. In addition to these,
443 \fBsystemd\-journald\fR
444 can listen for audit events using
445 \fBnetlink\fR(7), depending on whether
446 "systemd\-journald\-audit\&.socket"
447 is enabled or not\&.
448 .sp
449 Added in version 228\&.
450 .RE
451 .PP
452 If journal namespacing is used these paths are slightly altered to include a namespace identifier, see above\&.
453 .SH "SEE ALSO"
454 .PP
455 \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
456 .SH "NOTES"
457 .IP " 1." 4
458 Native Journal Protocol
459 .RS 4
460 \%https://systemd.io/JOURNAL_NATIVE_PROTOCOL
461 .RE
462 .IP " 2." 4
463 Users, Groups, UIDs and GIDs on systemd systems
464 .RS 4
465 \%https://systemd.io/UIDS-GIDS
466 .RE