2012-03-16 02:25:14 +04:00
<?xml version='1.0'?> <!-- * - nxml - * -->
2019-03-14 16:40:58 +03:00
< !DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
2015-06-18 20:47:44 +03:00
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
2020-11-09 07:23:58 +03:00
<!-- SPDX - License - Identifier: LGPL - 2.1 - or - later -->
2012-03-16 02:25:14 +04:00
2014-11-29 12:06:20 +03:00
<refentry id= "journald.conf"
2015-02-04 05:14:13 +03:00
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo >
<title > journald.conf</title>
<productname > systemd</productname>
</refentryinfo>
<refmeta >
<refentrytitle > journald.conf</refentrytitle>
<manvolnum > 5</manvolnum>
</refmeta>
<refnamediv >
<refname > journald.conf</refname>
<refname > journald.conf.d</refname>
2019-11-27 23:38:07 +03:00
<refname > journald@.conf</refname>
2015-02-04 05:14:13 +03:00
<refpurpose > Journal service configuration files</refpurpose>
</refnamediv>
<refsynopsisdiv >
2015-06-18 20:47:44 +03:00
<para > <filename > /etc/systemd/journald.conf</filename> </para>
<para > <filename > /etc/systemd/journald.conf.d/*.conf</filename> </para>
2015-02-04 05:14:13 +03:00
<para > <filename > /run/systemd/journald.conf.d/*.conf</filename> </para>
2015-06-18 20:47:44 +03:00
<para > <filename > /usr/lib/systemd/journald.conf.d/*.conf</filename> </para>
2019-11-27 23:38:07 +03:00
<para > <filename > /etc/systemd/journald@<replaceable > NAMESPACE</replaceable> .conf</filename> </para>
2021-03-04 10:38:18 +03:00
<para > <filename > /etc/systemd/journald@<replaceable > NAMESPACE</replaceable> .conf.d/*.conf</filename> </para>
<para > <filename > /run/systemd/journald@<replaceable > NAMESPACE</replaceable> .conf.d/*.conf</filename> </para>
<para > <filename > /usr/lib/systemd/journald@<replaceable > NAMESPACE</replaceable> .conf.d/*.conf</filename> </para>
2015-02-04 05:14:13 +03:00
</refsynopsisdiv>
<refsect1 >
<title > Description</title>
2018-04-16 18:09:58 +03:00
<para > These files configure various parameters of the systemd journal service,
<citerefentry > <refentrytitle > systemd-journald.service</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> .
See
2020-07-11 01:05:23 +03:00
<citerefentry > <refentrytitle > systemd.syntax</refentrytitle> <manvolnum > 7</manvolnum> </citerefentry>
2018-04-16 18:09:58 +03:00
for a general description of the syntax.</para>
2015-02-04 05:14:13 +03:00
2019-11-27 23:38:07 +03:00
<para > The <command > systemd-journald</command> instance managing the default namespace is configured by
<filename > /etc/systemd/journald.conf</filename> and associated drop-ins. Instances managing other
2021-03-04 10:38:18 +03:00
namespaces read <filename > /etc/systemd/journald@<replaceable > NAMESPACE</replaceable> .conf</filename>
and associated drop-ins with the namespace identifier filled in. This allows each namespace to carry
a distinct configuration. See
2019-11-27 23:38:07 +03:00
<citerefentry > <refentrytitle > systemd-journald.service</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry>
for details about journal namespaces.</para>
2015-02-04 05:14:13 +03:00
</refsect1>
2015-03-04 03:10:21 +03:00
<xi:include href= "standard-conf.xml" xpointer= "main-conf" />
2015-02-04 05:14:13 +03:00
<refsect1 >
<title > Options</title>
<para > All options are configured in the
2020-07-06 12:00:06 +03:00
[Journal] section:</para>
2015-02-04 05:14:13 +03:00
2019-02-13 12:49:47 +03:00
<variablelist class= 'config-directives' >
2015-02-04 05:14:13 +03:00
<varlistentry >
<term > <varname > Storage=</varname> </term>
2019-11-27 23:38:07 +03:00
<listitem > <para > Controls where to store journal data. One of <literal > volatile</literal> ,
<literal > persistent</literal> , <literal > auto</literal> and <literal > none</literal> . If
<literal > volatile</literal> , journal log data will be stored only in memory, i.e. below the
<filename > /run/log/journal</filename> hierarchy (which is created if needed). If
<literal > persistent</literal> , data will be stored preferably on disk, i.e. below the
<filename > /var/log/journal</filename> hierarchy (which is created if needed), with a fallback to
<filename > /run/log/journal</filename> (which is created if needed), during early boot and if the disk
2020-08-03 14:22:01 +03:00
is not writable. <literal > auto</literal> behaves like <literal > persistent</literal> if the
<filename > /var/log/journal</filename> directory exists, and <literal > volatile</literal> otherwise
(the existence of the directory controls the storage mode). <literal > none</literal> turns off all
storage, all log data received will be dropped (but forwarding to other targets, such as the console,
the kernel log buffer, or a syslog socket will still work). Defaults to <literal > auto</literal> in
the default journal namespace, and <literal > persistent</literal> in all others.</para>
2021-05-11 00:08:58 +03:00
<para > Note that journald will initially use volatile storage, until a call to
<command > journalctl --flush</command> (or sending <constant > SIGUSR1</constant> to journald) will cause
2021-05-03 18:08:25 +03:00
it to switch to persistent logging (under the conditions mentioned above). This is done automatically
on boot via <literal > systemd-journal-flush.service</literal> .</para>
2020-08-03 14:22:01 +03:00
<para > Note that when this option is changed to <literal > volatile</literal> , existing persistent data
is not removed. In the other direction,
<citerefentry > <refentrytitle > journalctl</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> with
the <option > --flush</option> option may be used to move volatile data to persistent storage.</para>
</listitem>
2015-02-04 05:14:13 +03:00
</varlistentry>
<varlistentry >
<term > <varname > Compress=</varname> </term>
2018-02-27 20:37:23 +03:00
<listitem > <para > Can take a boolean value. If enabled (the
default), data objects that shall be stored in the journal
and are larger than the default threshold of 512 bytes are
compressed before they are written to the file system. It
can also be set to a number of bytes to specify the
compression threshold directly. Suffixes like K, M, and G
can be used to specify larger units.</para> </listitem>
2015-02-04 05:14:13 +03:00
</varlistentry>
<varlistentry >
<term > <varname > Seal=</varname> </term>
<listitem > <para > Takes a boolean value. If enabled (the
default), and a sealing key is available (as created by
<citerefentry > <refentrytitle > journalctl</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> 's
<option > --setup-keys</option> command), Forward Secure Sealing
(FSS) for all persistent journal files is enabled. FSS is
based on <ulink
url="https://eprint.iacr.org/2013/397">Seekable Sequential Key
Generators</ulink> by G. A. Marson and B. Poettering
(doi:10.1007/978-3-642-40203-6_7) and may be used to protect
journal files from unnoticed alteration.</para> </listitem>
</varlistentry>
<varlistentry >
<term > <varname > SplitMode=</varname> </term>
2016-07-26 09:19:33 +03:00
<listitem > <para > Controls whether to split up journal files per user, either <literal > uid</literal> or
<literal > none</literal> . Split journal files are primarily useful for access control: on UNIX/Linux access
control is managed per file, and the journal daemon will assign users read access to their journal files. If
2019-12-19 03:09:49 +03:00
<literal > uid</literal> , all regular users (with UID outside the range of system users, dynamic service users,
and the nobody user) will each get their own journal files, and system users will log to the system journal.
See <ulink url= "https://systemd.io/UIDS-GIDS" > Users, Groups, UIDs and GIDs on systemd systems</ulink>
for more details about UID ranges.
If <literal > none</literal> , journal files are not split up by user and all messages are
2016-07-26 09:19:33 +03:00
instead stored in the single system journal. In this mode unprivileged users generally do not have access to
their own log data. Note that splitting up journal files by user is only available for journals stored
persistently. If journals are stored on volatile storage (see <varname > Storage=</varname> above), only a single
journal file is used. Defaults to <literal > uid</literal> .</para> </listitem>
2015-02-04 05:14:13 +03:00
</varlistentry>
<varlistentry >
2016-04-26 21:46:20 +03:00
<term > <varname > RateLimitIntervalSec=</varname> </term>
2015-02-04 05:14:13 +03:00
<term > <varname > RateLimitBurst=</varname> </term>
<listitem > <para > Configures the rate limiting that is applied
to all messages generated on the system. If, in the time
2016-04-26 21:46:20 +03:00
interval defined by <varname > RateLimitIntervalSec=</varname> ,
2015-02-04 05:14:13 +03:00
more messages than specified in
<varname > RateLimitBurst=</varname> are logged by a service,
all further messages within the interval are dropped until the
interval is over. A message about the number of dropped
messages is generated. This rate limiting is applied
per-service, so that two services which log do not interfere
2018-04-05 14:06:59 +03:00
with each other's limits. Defaults to 10000 messages in 30s.
2015-02-04 05:14:13 +03:00
The time specification for
2016-04-26 21:46:20 +03:00
<varname > RateLimitIntervalSec=</varname> may be specified in the
2015-02-04 05:14:13 +03:00
following units: <literal > s</literal> , <literal > min</literal> ,
<literal > h</literal> , <literal > ms</literal> ,
<literal > us</literal> . To turn off any kind of rate limiting,
2018-10-08 06:28:36 +03:00
set either value to 0.</para>
2020-04-23 03:26:32 +03:00
<para > Note that the effective rate limit is multiplied by a
2019-11-21 18:26:24 +03:00
factor derived from the available free disk space for the journal.
Currently, this factor is calculated using the base 2 logarithm.</para>
<table >
<title > Example <varname > RateLimitBurst=</varname> rate
modifications by the available disk space</title>
<tgroup cols= '2' >
<colspec colname= 'freespace' />
<colspec colname= 'multiplier' />
<thead >
<row >
<entry > Available Disk Space</entry>
<entry > Burst Multiplier</entry>
</row>
</thead>
<tbody >
<row >
<entry > < = 1MB</entry>
<entry > 1</entry>
</row>
<row >
<entry > < = 16MB</entry>
<entry > 2</entry>
</row>
<row >
<entry > < = 256MB</entry>
<entry > 3</entry>
</row>
<row >
<entry > < = 4GB</entry>
<entry > 4</entry>
</row>
<row >
<entry > < = 64GB</entry>
<entry > 5</entry>
</row>
<row >
<entry > < = 1TB</entry>
<entry > 6</entry>
</row>
</tbody>
</tgroup>
</table>
2018-10-08 06:28:36 +03:00
<para > If a service provides rate limits for itself through
<varname > LogRateLimitIntervalSec=</varname> and/or <varname > LogRateLimitBurst=</varname>
in <citerefentry > <refentrytitle > systemd.exec</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> ,
those values will override the settings specified here.</para>
</listitem>
2015-02-04 05:14:13 +03:00
</varlistentry>
<varlistentry >
<term > <varname > SystemMaxUse=</varname> </term>
<term > <varname > SystemKeepFree=</varname> </term>
<term > <varname > SystemMaxFileSize=</varname> </term>
2015-10-03 00:21:59 +03:00
<term > <varname > SystemMaxFiles=</varname> </term>
2015-02-04 05:14:13 +03:00
<term > <varname > RuntimeMaxUse=</varname> </term>
<term > <varname > RuntimeKeepFree=</varname> </term>
<term > <varname > RuntimeMaxFileSize=</varname> </term>
2015-10-03 00:21:59 +03:00
<term > <varname > RuntimeMaxFiles=</varname> </term>
2015-02-04 05:14:13 +03:00
<listitem > <para > Enforce size limits on the journal files
stored. The options prefixed with <literal > System</literal>
apply to the journal files when stored on a persistent file
system, more specifically
<filename > /var/log/journal</filename> . The options prefixed
with <literal > Runtime</literal> apply to the journal files
when stored on a volatile in-memory file system, more
specifically <filename > /run/log/journal</filename> . The former
2020-10-05 19:08:21 +03:00
is used only when <filename > /var/</filename> is mounted,
2015-02-04 05:14:13 +03:00
writable, and the directory
<filename > /var/log/journal</filename> exists. Otherwise, only
the latter applies. Note that this means that during early
boot and if the administrator disabled persistent logging,
only the latter options apply, while the former apply if
persistent logging is enabled and the system is fully booted
up. <command > journalctl</command> and
<command > systemd-journald</command> ignore all files with
names not ending with <literal > .journal</literal> or
<literal > .journal~</literal> , so only such files, located in
the appropriate directories, are taken into account when
2015-10-03 00:21:59 +03:00
calculating current disk usage.</para>
2015-02-04 05:14:13 +03:00
<para > <varname > SystemMaxUse=</varname> and
<varname > RuntimeMaxUse=</varname> control how much disk space
2014-08-03 09:11:37 +04:00
the journal may use up at most.
2015-02-04 05:14:13 +03:00
<varname > SystemKeepFree=</varname> and
<varname > RuntimeKeepFree=</varname> control how much disk
space systemd-journald shall leave free for other uses.
<command > systemd-journald</command> will respect both limits
and use the smaller of the two values.</para>
<para > The first pair defaults to 10% and the second to 15% of
2015-10-03 12:34:11 +03:00
the size of the respective file system, but each value is
capped to 4G. If the file system is nearly full and either
<varname > SystemKeepFree=</varname> or
2015-10-03 00:21:59 +03:00
<varname > RuntimeKeepFree=</varname> are violated when
systemd-journald is started, the limit will be raised to the
2015-02-04 05:14:13 +03:00
percentage that is actually free. This means that if there was
enough free space before and journal files were created, and
subsequently something else causes the file system to fill up,
journald will stop using more space, but it will not be
2014-08-03 09:11:37 +04:00
removing existing files to reduce the footprint again,
2018-06-22 16:45:41 +03:00
either. Also note that only archived files are deleted to reduce the
space occupied by journal files. This means that, in effect, there might
still be more space used than <varname > SystemMaxUse=</varname> or
<varname > RuntimeMaxUse=</varname> limit after a vacuuming operation is
complete.</para>
2015-02-04 05:14:13 +03:00
2015-05-10 00:20:51 +03:00
<para > <varname > SystemMaxFileSize=</varname> and
<varname > RuntimeMaxFileSize=</varname> control how large
2014-08-03 09:11:37 +04:00
individual journal files may grow at most. This influences
2015-05-10 00:20:51 +03:00
the granularity in which disk space is made available through
rotation, i.e. deletion of historic data. Defaults to one
eighth of the values configured with
2015-02-04 05:14:13 +03:00
<varname > SystemMaxUse=</varname> and
2015-05-10 00:20:51 +03:00
<varname > RuntimeMaxUse=</varname> , so that usually seven
2015-10-03 00:21:59 +03:00
rotated journal files are kept as history.</para>
2015-06-17 11:12:09 +03:00
<para > Specify values in bytes or use K, M, G, T, P, E as
2016-12-12 01:01:07 +03:00
units for the specified sizes (equal to 1024, 1024², … bytes).
2015-06-17 11:12:09 +03:00
Note that size limits are enforced synchronously when journal
files are extended, and no explicit rotation step triggered by
time is needed.</para>
2015-10-03 00:21:59 +03:00
<para > <varname > SystemMaxFiles=</varname> and
<varname > RuntimeMaxFiles=</varname> control how many
2014-08-03 09:11:37 +04:00
individual journal files to keep at most. Note that only
2015-10-03 00:21:59 +03:00
archived files are deleted to reduce the number of files until
this limit is reached; active files will stay around. This
2014-08-03 09:11:12 +04:00
means that, in effect, there might still be more journal files
2015-10-03 00:21:59 +03:00
around in total than this limit after a vacuuming operation is
complete. This setting defaults to 100.</para> </listitem>
2015-02-04 05:14:13 +03:00
</varlistentry>
<varlistentry >
<term > <varname > MaxFileSec=</varname> </term>
<listitem > <para > The maximum time to store entries in a single
journal file before rotating to the next one. Normally,
time-based rotation should not be required as size-based
rotation with options such as
<varname > SystemMaxFileSize=</varname> should be sufficient to
ensure that journal files do not grow without bounds. However,
to ensure that not too much data is lost at once when old
journal files are deleted, it might make sense to change this
value from the default of one month. Set to 0 to turn off this
feature. This setting takes time values which may be suffixed
with the units <literal > year</literal> ,
<literal > month</literal> , <literal > week</literal> ,
<literal > day</literal> , <literal > h</literal> or
<literal > m</literal> to override the default time unit of
seconds.</para> </listitem>
</varlistentry>
<varlistentry >
<term > <varname > MaxRetentionSec=</varname> </term>
<listitem > <para > The maximum time to store journal entries.
This controls whether journal files containing entries older
2018-12-28 21:35:46 +03:00
than the specified time span are deleted. Normally, time-based
2015-02-04 05:14:13 +03:00
deletion of old journal files should not be required as
size-based deletion with options such as
<varname > SystemMaxUse=</varname> should be sufficient to
ensure that journal files do not grow without bounds. However,
to enforce data retention policies, it might make sense to
change this value from the default of 0 (which turns off this
feature). This setting also takes time values which may be
suffixed with the units <literal > year</literal> ,
<literal > month</literal> , <literal > week</literal> ,
<literal > day</literal> , <literal > h</literal> or <literal >
m</literal> to override the default time unit of
seconds.</para> </listitem>
</varlistentry>
<varlistentry >
<term > <varname > SyncIntervalSec=</varname> </term>
<listitem > <para > The timeout before synchronizing journal files
to disk. After syncing, journal files are placed in the
OFFLINE state. Note that syncing is unconditionally done
immediately after a log message of priority CRIT, ALERT or
EMERG has been logged. This setting hence applies only to
messages of the levels ERR, WARNING, NOTICE, INFO, DEBUG. The
default timeout is 5 minutes. </para> </listitem>
</varlistentry>
<varlistentry >
<term > <varname > ForwardToSyslog=</varname> </term>
<term > <varname > ForwardToKMsg=</varname> </term>
<term > <varname > ForwardToConsole=</varname> </term>
<term > <varname > ForwardToWall=</varname> </term>
2019-07-29 10:24:09 +03:00
<listitem > <para > Control whether log messages received by the journal daemon shall be forwarded to a
traditional syslog daemon, to the kernel log buffer (kmsg), to the system console, or sent as wall
messages to all logged-in users. These options take boolean arguments. If forwarding to syslog is
enabled but nothing reads messages from the socket, forwarding to syslog has no effect. By default,
only forwarding to wall is enabled. These settings may be overridden at boot time with the kernel
command line options <literal > systemd.journald.forward_to_syslog</literal> ,
2016-10-22 21:25:30 +03:00
<literal > systemd.journald.forward_to_kmsg</literal> ,
<literal > systemd.journald.forward_to_console</literal> , and
2019-07-29 10:24:09 +03:00
<literal > systemd.journald.forward_to_wall</literal> . If the option name is specified without
<literal > =</literal> and the following argument, true is assumed. Otherwise, the argument is parsed
as a boolean.</para>
<para > When forwarding to the console, the TTY to log to can be changed with
<varname > TTYPath=</varname> , described below.</para>
<para > When forwarding to the kernel log buffer (kmsg), make sure to select a suitably large size for
2020-03-03 16:57:03 +03:00
the log buffer, for example by adding <literal > log_buf_len=8M</literal> to the kernel command line.
<command > systemd</command> will automatically disable kernel's rate-limiting applied to userspace
processes (equivalent to setting <literal > printk.devkmsg=on</literal> ).</para> </listitem>
2015-02-04 05:14:13 +03:00
</varlistentry>
<varlistentry >
<term > <varname > MaxLevelStore=</varname> </term>
<term > <varname > MaxLevelSyslog=</varname> </term>
<term > <varname > MaxLevelKMsg=</varname> </term>
<term > <varname > MaxLevelConsole=</varname> </term>
<term > <varname > MaxLevelWall=</varname> </term>
<listitem > <para > Controls the maximum log level of messages
2020-01-16 19:24:07 +03:00
that are stored in the journal, forwarded to syslog, kmsg, the
2015-02-04 05:14:13 +03:00
console or wall (if that is enabled, see above). As argument,
takes one of
<literal > emerg</literal> ,
<literal > alert</literal> ,
<literal > crit</literal> ,
<literal > err</literal> ,
<literal > warning</literal> ,
<literal > notice</literal> ,
<literal > info</literal> ,
<literal > debug</literal> ,
2014-08-03 09:11:12 +04:00
or integer values in the range of 0– 7 (corresponding to the
2015-02-04 05:14:13 +03:00
same levels). Messages equal or below the log level specified
are stored/forwarded, messages above are dropped. Defaults to
<literal > debug</literal> for <varname > MaxLevelStore=</varname>
and <varname > MaxLevelSyslog=</varname> , to ensure that the all
2020-01-16 19:24:07 +03:00
messages are stored in the journal and forwarded to syslog.
Defaults to
2015-02-04 05:14:13 +03:00
<literal > notice</literal> for <varname > MaxLevelKMsg=</varname> ,
<literal > info</literal> for <varname > MaxLevelConsole=</varname> ,
and <literal > emerg</literal> for
2016-10-22 02:40:55 +03:00
<varname > MaxLevelWall=</varname> . These settings may be
overridden at boot time with the kernel command line options
<literal > systemd.journald.max_level_store=</literal> ,
<literal > systemd.journald.max_level_syslog=</literal> ,
<literal > systemd.journald.max_level_kmsg=</literal> ,
<literal > systemd.journald.max_level_console=</literal> ,
<literal > systemd.journald.max_level_wall=</literal> .</para>
</listitem>
2015-02-04 05:14:13 +03:00
</varlistentry>
2017-07-15 14:57:52 +03:00
<varlistentry >
<term > <varname > ReadKMsg=</varname> </term>
2019-11-27 23:38:07 +03:00
<listitem > <para > Takes a boolean value. If enabled <command > systemd-journal</command> processes
<filename > /dev/kmsg</filename> messages generated by the kernel. In the default journal namespace
this option is enabled by default, it is disabled in all others.</para> </listitem>
2017-07-15 14:57:52 +03:00
</varlistentry>
2020-04-16 13:04:03 +03:00
<varlistentry >
<term > <varname > Audit=</varname> </term>
<listitem > <para > Takes a boolean value. If enabled <command > systemd-journal</command> will turn on
kernel auditing on start-up. If disabled it will turn it off. If unset it will neither enable nor
disable it, leaving the previous state unchanged. Note that this option does not control whether
<command > systemd-journald</command> collects generated audit records, it just controls whether it
tells the kernel to generate them. This means if another tool turns on auditing even if
<command > systemd-journald</command> left it off, it will still collect the generated
messages. Defaults to on.</para> </listitem>
</varlistentry>
2015-02-04 05:14:13 +03:00
<varlistentry >
<term > <varname > TTYPath=</varname> </term>
<listitem > <para > Change the console TTY to use if
<varname > ForwardToConsole=yes</varname> is used. Defaults to
<filename > /dev/console</filename> .</para> </listitem>
</varlistentry>
journald: make maximum size of stream log lines configurable and bump it to 48K (#6838)
This adds a new setting LineMax= to journald.conf, and sets it by
default to 48K. When we convert stream-based stdout/stderr logging into
record-based log entries, read up to the specified amount of bytes
before forcing a line-break.
This also makes three related changes:
- When a NUL byte is read we'll not recognize this as alternative line
break, instead of silently dropping everything after it. (see #4863)
- The reason for a line-break is now encoded in the log record, if it
wasn't a plain newline. Specifically, we distuingish "nul",
"line-max" and "eof", for line breaks due to NUL byte, due to the
maximum line length as configured with LineMax= or due to end of
stream. This data is stored in the new implicit _LINE_BREAK= field.
It's not synthesized for plain \n line breaks.
- A randomized 128bit ID is assigned to each log stream.
With these three changes in place it's (mostly) possible to reconstruct
the original byte streams from log data, as (most) of the context of
the conversion from the byte stream to log records is saved now. (So,
the only bits we still drop are empty lines. Which might be something to
look into in a future change, and which is outside of the scope of this
work)
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86465
See: #4863
Replaces: #4875
2017-09-22 11:22:24 +03:00
<varlistentry >
<term > <varname > LineMax=</varname> </term>
<listitem > <para > The maximum line length to permit when converting stream logs into record logs. When a systemd
unit's standard output/error are connected to the journal via a stream socket, the data read is split into
2020-11-12 10:58:00 +03:00
individual log records at newline (<literal > \n</literal> , ASCII 10) and <constant > NUL</constant> characters. If no such delimiter is
2017-10-10 22:59:03 +03:00
read for the specified number of bytes a hard log record boundary is artificially inserted, breaking up overly
journald: make maximum size of stream log lines configurable and bump it to 48K (#6838)
This adds a new setting LineMax= to journald.conf, and sets it by
default to 48K. When we convert stream-based stdout/stderr logging into
record-based log entries, read up to the specified amount of bytes
before forcing a line-break.
This also makes three related changes:
- When a NUL byte is read we'll not recognize this as alternative line
break, instead of silently dropping everything after it. (see #4863)
- The reason for a line-break is now encoded in the log record, if it
wasn't a plain newline. Specifically, we distuingish "nul",
"line-max" and "eof", for line breaks due to NUL byte, due to the
maximum line length as configured with LineMax= or due to end of
stream. This data is stored in the new implicit _LINE_BREAK= field.
It's not synthesized for plain \n line breaks.
- A randomized 128bit ID is assigned to each log stream.
With these three changes in place it's (mostly) possible to reconstruct
the original byte streams from log data, as (most) of the context of
the conversion from the byte stream to log records is saved now. (So,
the only bits we still drop are empty lines. Which might be something to
look into in a future change, and which is outside of the scope of this
work)
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86465
See: #4863
Replaces: #4875
2017-09-22 11:22:24 +03:00
long lines into multiple log records. Selecting overly large values increases the possible memory usage of the
Journal daemon for each stream client, as in the worst case the journal daemon needs to buffer the specified
number of bytes in memory before it can flush a new log record to disk. Also note that permitting overly large
line maximum line lengths affects compatibility with traditional log protocols as log records might not fit
anymore into a single <constant > AF_UNIX</constant> or <constant > AF_INET</constant> datagram. Takes a size in
bytes. If the value is suffixed with K, M, G or T, the specified size is parsed as Kilobytes, Megabytes,
Gigabytes, or Terabytes (with the base 1024), respectively. Defaults to 48K, which is relatively large but
still small enough so that log records likely fit into network datagrams along with extra room for
metadata. Note that values below 79 are not accepted and will be bumped to 79.</para> </listitem>
</varlistentry>
2015-02-04 05:14:13 +03:00
</variablelist>
</refsect1>
2015-05-10 00:20:51 +03:00
<refsect1 >
<title > Forwarding to traditional syslog daemons</title>
<para >
2015-05-10 02:46:15 +03:00
Journal events can be transferred to a different logging daemon
2014-08-03 09:11:37 +04:00
in two different ways. With the first method, messages are
2015-05-10 00:20:51 +03:00
immediately forwarded to a socket
(<filename > /run/systemd/journal/syslog</filename> ), where the
traditional syslog daemon can read them. This method is
2014-08-03 09:11:37 +04:00
controlled by the <varname > ForwardToSyslog=</varname> option. With a
2015-05-10 00:20:51 +03:00
second method, a syslog daemon behaves like a normal journal
client, and reads messages from the journal files, similarly to
<citerefentry > <refentrytitle > journalctl</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> .
2014-08-03 09:11:37 +04:00
With this, messages do not have to be read immediately,
2015-05-10 00:20:51 +03:00
which allows a logging daemon which is only started late in boot
to access all messages since the start of the system. In
addition, full structured meta-data is available to it. This
method of course is available only if the messages are stored in
2015-05-10 02:46:15 +03:00
a journal file at all. So it will not work if
2015-05-10 00:20:51 +03:00
<varname > Storage=none</varname> is set. It should be noted that
2015-05-10 02:46:15 +03:00
usually the <emphasis > second</emphasis> method is used by syslog
2015-05-10 00:20:51 +03:00
daemons, so the <varname > Storage=</varname> option, and not the
<varname > ForwardToSyslog=</varname> option, is relevant for them.
</para>
</refsect1>
2015-02-04 05:14:13 +03:00
<refsect1 >
<title > See Also</title>
<para >
<citerefentry > <refentrytitle > systemd</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> ,
<citerefentry > <refentrytitle > systemd-journald.service</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> ,
<citerefentry > <refentrytitle > journalctl</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> ,
<citerefentry > <refentrytitle > systemd.journal-fields</refentrytitle> <manvolnum > 7</manvolnum> </citerefentry> ,
<citerefentry > <refentrytitle > systemd-system.conf</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry>
</para>
</refsect1>
2012-03-16 02:25:14 +04:00
</refentry>