]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/journald.conf.xml
test/test-functions: avoid stderr noise, only umount on cleanup if mountpoint
[thirdparty/systemd.git] / man / journald.conf.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="journald.conf"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8 <refentryinfo>
9 <title>journald.conf</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>journald.conf</refentrytitle>
15 <manvolnum>5</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>journald.conf</refname>
20 <refname>journald.conf.d</refname>
21 <refpurpose>Journal service configuration files</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <para><filename>/etc/systemd/journald.conf</filename></para>
26 <para><filename>/etc/systemd/journald.conf.d/*.conf</filename></para>
27 <para><filename>/run/systemd/journald.conf.d/*.conf</filename></para>
28 <para><filename>/usr/lib/systemd/journald.conf.d/*.conf</filename></para>
29 </refsynopsisdiv>
30
31 <refsect1>
32 <title>Description</title>
33
34 <para>These files configure various parameters of the systemd journal service,
35 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
36 See
37 <citerefentry><refentrytitle>systemd.syntax</refentrytitle><manvolnum>5</manvolnum></citerefentry>
38 for a general description of the syntax.</para>
39
40 </refsect1>
41
42 <xi:include href="standard-conf.xml" xpointer="main-conf" />
43
44 <refsect1>
45 <title>Options</title>
46
47 <para>All options are configured in the
48 <literal>[Journal]</literal> section:</para>
49
50 <variablelist class='config-directives'>
51
52 <varlistentry>
53 <term><varname>Storage=</varname></term>
54
55 <listitem><para>Controls where to store journal data. One of
56 <literal>volatile</literal>,
57 <literal>persistent</literal>,
58 <literal>auto</literal> and
59 <literal>none</literal>. If
60 <literal>volatile</literal>, journal
61 log data will be stored only in memory, i.e. below the
62 <filename>/run/log/journal</filename> hierarchy (which is
63 created if needed). If <literal>persistent</literal>, data
64 will be stored preferably on disk, i.e. below the
65 <filename>/var/log/journal</filename> hierarchy (which is
66 created if needed), with a fallback to
67 <filename>/run/log/journal</filename> (which is created if
68 needed), during early boot and if the disk is not writable.
69 <literal>auto</literal> is similar to
70 <literal>persistent</literal> but the directory
71 <filename>/var/log/journal</filename> is not created if
72 needed, so that its existence controls where log data goes.
73 <literal>none</literal> turns off all storage, all log data
74 received will be dropped. Forwarding to other targets, such as
75 the console, the kernel log buffer, or a syslog socket will
76 still work however. Defaults to
77 <literal>auto</literal>.</para></listitem>
78 </varlistentry>
79
80 <varlistentry>
81 <term><varname>Compress=</varname></term>
82
83 <listitem><para>Can take a boolean value. If enabled (the
84 default), data objects that shall be stored in the journal
85 and are larger than the default threshold of 512 bytes are
86 compressed before they are written to the file system. It
87 can also be set to a number of bytes to specify the
88 compression threshold directly. Suffixes like K, M, and G
89 can be used to specify larger units.</para></listitem>
90 </varlistentry>
91
92 <varlistentry>
93 <term><varname>Seal=</varname></term>
94
95 <listitem><para>Takes a boolean value. If enabled (the
96 default), and a sealing key is available (as created by
97 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
98 <option>--setup-keys</option> command), Forward Secure Sealing
99 (FSS) for all persistent journal files is enabled. FSS is
100 based on <ulink
101 url="https://eprint.iacr.org/2013/397">Seekable Sequential Key
102 Generators</ulink> by G. A. Marson and B. Poettering
103 (doi:10.1007/978-3-642-40203-6_7) and may be used to protect
104 journal files from unnoticed alteration.</para></listitem>
105 </varlistentry>
106
107 <varlistentry>
108 <term><varname>SplitMode=</varname></term>
109
110 <listitem><para>Controls whether to split up journal files per user, either <literal>uid</literal> or
111 <literal>none</literal>. Split journal files are primarily useful for access control: on UNIX/Linux access
112 control is managed per file, and the journal daemon will assign users read access to their journal files. If
113 <literal>uid</literal>, all regular users will each get their own journal files, and system users will log to
114 the system journal. If <literal>none</literal>, journal files are not split up by user and all messages are
115 instead stored in the single system journal. In this mode unprivileged users generally do not have access to
116 their own log data. Note that splitting up journal files by user is only available for journals stored
117 persistently. If journals are stored on volatile storage (see <varname>Storage=</varname> above), only a single
118 journal file is used. Defaults to <literal>uid</literal>.</para></listitem>
119 </varlistentry>
120
121 <varlistentry>
122 <term><varname>RateLimitIntervalSec=</varname></term>
123 <term><varname>RateLimitBurst=</varname></term>
124
125 <listitem><para>Configures the rate limiting that is applied
126 to all messages generated on the system. If, in the time
127 interval defined by <varname>RateLimitIntervalSec=</varname>,
128 more messages than specified in
129 <varname>RateLimitBurst=</varname> are logged by a service,
130 all further messages within the interval are dropped until the
131 interval is over. A message about the number of dropped
132 messages is generated. This rate limiting is applied
133 per-service, so that two services which log do not interfere
134 with each other's limits. Defaults to 10000 messages in 30s.
135 The time specification for
136 <varname>RateLimitIntervalSec=</varname> may be specified in the
137 following units: <literal>s</literal>, <literal>min</literal>,
138 <literal>h</literal>, <literal>ms</literal>,
139 <literal>us</literal>. To turn off any kind of rate limiting,
140 set either value to 0.</para>
141
142 <para>If a service provides rate limits for itself through
143 <varname>LogRateLimitIntervalSec=</varname> and/or <varname>LogRateLimitBurst=</varname>
144 in <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
145 those values will override the settings specified here.</para>
146 </listitem>
147 </varlistentry>
148
149 <varlistentry>
150 <term><varname>SystemMaxUse=</varname></term>
151 <term><varname>SystemKeepFree=</varname></term>
152 <term><varname>SystemMaxFileSize=</varname></term>
153 <term><varname>SystemMaxFiles=</varname></term>
154 <term><varname>RuntimeMaxUse=</varname></term>
155 <term><varname>RuntimeKeepFree=</varname></term>
156 <term><varname>RuntimeMaxFileSize=</varname></term>
157 <term><varname>RuntimeMaxFiles=</varname></term>
158
159 <listitem><para>Enforce size limits on the journal files
160 stored. The options prefixed with <literal>System</literal>
161 apply to the journal files when stored on a persistent file
162 system, more specifically
163 <filename>/var/log/journal</filename>. The options prefixed
164 with <literal>Runtime</literal> apply to the journal files
165 when stored on a volatile in-memory file system, more
166 specifically <filename>/run/log/journal</filename>. The former
167 is used only when <filename>/var</filename> is mounted,
168 writable, and the directory
169 <filename>/var/log/journal</filename> exists. Otherwise, only
170 the latter applies. Note that this means that during early
171 boot and if the administrator disabled persistent logging,
172 only the latter options apply, while the former apply if
173 persistent logging is enabled and the system is fully booted
174 up. <command>journalctl</command> and
175 <command>systemd-journald</command> ignore all files with
176 names not ending with <literal>.journal</literal> or
177 <literal>.journal~</literal>, so only such files, located in
178 the appropriate directories, are taken into account when
179 calculating current disk usage.</para>
180
181 <para><varname>SystemMaxUse=</varname> and
182 <varname>RuntimeMaxUse=</varname> control how much disk space
183 the journal may use up at most.
184 <varname>SystemKeepFree=</varname> and
185 <varname>RuntimeKeepFree=</varname> control how much disk
186 space systemd-journald shall leave free for other uses.
187 <command>systemd-journald</command> will respect both limits
188 and use the smaller of the two values.</para>
189
190 <para>The first pair defaults to 10% and the second to 15% of
191 the size of the respective file system, but each value is
192 capped to 4G. If the file system is nearly full and either
193 <varname>SystemKeepFree=</varname> or
194 <varname>RuntimeKeepFree=</varname> are violated when
195 systemd-journald is started, the limit will be raised to the
196 percentage that is actually free. This means that if there was
197 enough free space before and journal files were created, and
198 subsequently something else causes the file system to fill up,
199 journald will stop using more space, but it will not be
200 removing existing files to reduce the footprint again,
201 either. Also note that only archived files are deleted to reduce the
202 space occupied by journal files. This means that, in effect, there might
203 still be more space used than <varname>SystemMaxUse=</varname> or
204 <varname>RuntimeMaxUse=</varname> limit after a vacuuming operation is
205 complete.</para>
206
207 <para><varname>SystemMaxFileSize=</varname> and
208 <varname>RuntimeMaxFileSize=</varname> control how large
209 individual journal files may grow at most. This influences
210 the granularity in which disk space is made available through
211 rotation, i.e. deletion of historic data. Defaults to one
212 eighth of the values configured with
213 <varname>SystemMaxUse=</varname> and
214 <varname>RuntimeMaxUse=</varname>, so that usually seven
215 rotated journal files are kept as history.</para>
216
217 <para>Specify values in bytes or use K, M, G, T, P, E as
218 units for the specified sizes (equal to 1024, 1024², … bytes).
219 Note that size limits are enforced synchronously when journal
220 files are extended, and no explicit rotation step triggered by
221 time is needed.</para>
222
223 <para><varname>SystemMaxFiles=</varname> and
224 <varname>RuntimeMaxFiles=</varname> control how many
225 individual journal files to keep at most. Note that only
226 archived files are deleted to reduce the number of files until
227 this limit is reached; active files will stay around. This
228 means that, in effect, there might still be more journal files
229 around in total than this limit after a vacuuming operation is
230 complete. This setting defaults to 100.</para></listitem>
231 </varlistentry>
232
233 <varlistentry>
234 <term><varname>MaxFileSec=</varname></term>
235
236 <listitem><para>The maximum time to store entries in a single
237 journal file before rotating to the next one. Normally,
238 time-based rotation should not be required as size-based
239 rotation with options such as
240 <varname>SystemMaxFileSize=</varname> should be sufficient to
241 ensure that journal files do not grow without bounds. However,
242 to ensure that not too much data is lost at once when old
243 journal files are deleted, it might make sense to change this
244 value from the default of one month. Set to 0 to turn off this
245 feature. This setting takes time values which may be suffixed
246 with the units <literal>year</literal>,
247 <literal>month</literal>, <literal>week</literal>,
248 <literal>day</literal>, <literal>h</literal> or
249 <literal>m</literal> to override the default time unit of
250 seconds.</para></listitem>
251 </varlistentry>
252
253 <varlistentry>
254 <term><varname>MaxRetentionSec=</varname></term>
255
256 <listitem><para>The maximum time to store journal entries.
257 This controls whether journal files containing entries older
258 than the specified time span are deleted. Normally, time-based
259 deletion of old journal files should not be required as
260 size-based deletion with options such as
261 <varname>SystemMaxUse=</varname> should be sufficient to
262 ensure that journal files do not grow without bounds. However,
263 to enforce data retention policies, it might make sense to
264 change this value from the default of 0 (which turns off this
265 feature). This setting also takes time values which may be
266 suffixed with the units <literal>year</literal>,
267 <literal>month</literal>, <literal>week</literal>,
268 <literal>day</literal>, <literal>h</literal> or <literal>
269 m</literal> to override the default time unit of
270 seconds.</para></listitem>
271 </varlistentry>
272
273 <varlistentry>
274 <term><varname>SyncIntervalSec=</varname></term>
275
276 <listitem><para>The timeout before synchronizing journal files
277 to disk. After syncing, journal files are placed in the
278 OFFLINE state. Note that syncing is unconditionally done
279 immediately after a log message of priority CRIT, ALERT or
280 EMERG has been logged. This setting hence applies only to
281 messages of the levels ERR, WARNING, NOTICE, INFO, DEBUG. The
282 default timeout is 5 minutes. </para></listitem>
283 </varlistentry>
284
285 <varlistentry>
286 <term><varname>ForwardToSyslog=</varname></term>
287 <term><varname>ForwardToKMsg=</varname></term>
288 <term><varname>ForwardToConsole=</varname></term>
289 <term><varname>ForwardToWall=</varname></term>
290
291 <listitem><para>Control whether log messages received by the journal daemon shall be forwarded to a
292 traditional syslog daemon, to the kernel log buffer (kmsg), to the system console, or sent as wall
293 messages to all logged-in users. These options take boolean arguments. If forwarding to syslog is
294 enabled but nothing reads messages from the socket, forwarding to syslog has no effect. By default,
295 only forwarding to wall is enabled. These settings may be overridden at boot time with the kernel
296 command line options <literal>systemd.journald.forward_to_syslog</literal>,
297 <literal>systemd.journald.forward_to_kmsg</literal>,
298 <literal>systemd.journald.forward_to_console</literal>, and
299 <literal>systemd.journald.forward_to_wall</literal>. If the option name is specified without
300 <literal>=</literal> and the following argument, true is assumed. Otherwise, the argument is parsed
301 as a boolean.</para>
302
303 <para>When forwarding to the console, the TTY to log to can be changed with
304 <varname>TTYPath=</varname>, described below.</para>
305
306 <para>When forwarding to the kernel log buffer (kmsg), make sure to select a suitably large size for
307 the log buffer, and ensure the kernel's rate-limiting applied to userspace processes is turned
308 off. Specifically, add <literal>log_buf_len=8M</literal> and <literal>printk.devkmsg=on</literal> (or
309 similar) to the kernel command line.</para></listitem>
310 </varlistentry>
311
312 <varlistentry>
313 <term><varname>MaxLevelStore=</varname></term>
314 <term><varname>MaxLevelSyslog=</varname></term>
315 <term><varname>MaxLevelKMsg=</varname></term>
316 <term><varname>MaxLevelConsole=</varname></term>
317 <term><varname>MaxLevelWall=</varname></term>
318
319 <listitem><para>Controls the maximum log level of messages
320 that are stored on disk, forwarded to syslog, kmsg, the
321 console or wall (if that is enabled, see above). As argument,
322 takes one of
323 <literal>emerg</literal>,
324 <literal>alert</literal>,
325 <literal>crit</literal>,
326 <literal>err</literal>,
327 <literal>warning</literal>,
328 <literal>notice</literal>,
329 <literal>info</literal>,
330 <literal>debug</literal>,
331 or integer values in the range of 07 (corresponding to the
332 same levels). Messages equal or below the log level specified
333 are stored/forwarded, messages above are dropped. Defaults to
334 <literal>debug</literal> for <varname>MaxLevelStore=</varname>
335 and <varname>MaxLevelSyslog=</varname>, to ensure that the all
336 messages are written to disk and forwarded to syslog. Defaults
337 to
338 <literal>notice</literal> for <varname>MaxLevelKMsg=</varname>,
339 <literal>info</literal> for <varname>MaxLevelConsole=</varname>,
340 and <literal>emerg</literal> for
341 <varname>MaxLevelWall=</varname>. These settings may be
342 overridden at boot time with the kernel command line options
343 <literal>systemd.journald.max_level_store=</literal>,
344 <literal>systemd.journald.max_level_syslog=</literal>,
345 <literal>systemd.journald.max_level_kmsg=</literal>,
346 <literal>systemd.journald.max_level_console=</literal>,
347 <literal>systemd.journald.max_level_wall=</literal>.</para>
348 </listitem>
349 </varlistentry>
350
351 <varlistentry>
352 <term><varname>ReadKMsg=</varname></term>
353
354 <listitem><para>Takes a boolean value. If enabled (the
355 default), journal reads <filename>/dev/kmsg</filename>
356 messages generated by the kernel.</para></listitem>
357 </varlistentry>
358
359 <varlistentry>
360 <term><varname>TTYPath=</varname></term>
361
362 <listitem><para>Change the console TTY to use if
363 <varname>ForwardToConsole=yes</varname> is used. Defaults to
364 <filename>/dev/console</filename>.</para></listitem>
365 </varlistentry>
366
367 <varlistentry>
368 <term><varname>LineMax=</varname></term>
369
370 <listitem><para>The maximum line length to permit when converting stream logs into record logs. When a systemd
371 unit's standard output/error are connected to the journal via a stream socket, the data read is split into
372 individual log records at newline (<literal>\n</literal>, ASCII 10) and NUL characters. If no such delimiter is
373 read for the specified number of bytes a hard log record boundary is artificially inserted, breaking up overly
374 long lines into multiple log records. Selecting overly large values increases the possible memory usage of the
375 Journal daemon for each stream client, as in the worst case the journal daemon needs to buffer the specified
376 number of bytes in memory before it can flush a new log record to disk. Also note that permitting overly large
377 line maximum line lengths affects compatibility with traditional log protocols as log records might not fit
378 anymore into a single <constant>AF_UNIX</constant> or <constant>AF_INET</constant> datagram. Takes a size in
379 bytes. If the value is suffixed with K, M, G or T, the specified size is parsed as Kilobytes, Megabytes,
380 Gigabytes, or Terabytes (with the base 1024), respectively. Defaults to 48K, which is relatively large but
381 still small enough so that log records likely fit into network datagrams along with extra room for
382 metadata. Note that values below 79 are not accepted and will be bumped to 79.</para></listitem>
383 </varlistentry>
384
385 </variablelist>
386
387 </refsect1>
388
389 <refsect1>
390 <title>Forwarding to traditional syslog daemons</title>
391
392 <para>
393 Journal events can be transferred to a different logging daemon
394 in two different ways. With the first method, messages are
395 immediately forwarded to a socket
396 (<filename>/run/systemd/journal/syslog</filename>), where the
397 traditional syslog daemon can read them. This method is
398 controlled by the <varname>ForwardToSyslog=</varname> option. With a
399 second method, a syslog daemon behaves like a normal journal
400 client, and reads messages from the journal files, similarly to
401 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
402 With this, messages do not have to be read immediately,
403 which allows a logging daemon which is only started late in boot
404 to access all messages since the start of the system. In
405 addition, full structured meta-data is available to it. This
406 method of course is available only if the messages are stored in
407 a journal file at all. So it will not work if
408 <varname>Storage=none</varname> is set. It should be noted that
409 usually the <emphasis>second</emphasis> method is used by syslog
410 daemons, so the <varname>Storage=</varname> option, and not the
411 <varname>ForwardToSyslog=</varname> option, is relevant for them.
412 </para>
413 </refsect1>
414
415 <refsect1>
416 <title>See Also</title>
417 <para>
418 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
419 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
420 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
421 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
422 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
423 </para>
424 </refsect1>
425
426 </refentry>