mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
journald: allow default storage mode to be configured
So far the idea was that the default is 'auto', and if appropriate, the distribution will create /var/log/journal/ to tell journald to use persistent mode. This doesn't work well with factory resets, because after a factory reset obviously /var/log is gone. That old default was useful when journald was new and people were reluctant to enable persistent mode and instead relied on rsyslog and such for the persistent storage. But nowadays that is rarer, and anyway various features like user journals only work with persistent storage, so we want people to enable this by default. Add an option to flip the default and distributions can opt in. The default default value remains unchanged. (I also tested using tmpfiles to instead change this, since we already set access mode for /var/log/journal through tmpfiles. Unfortunately, tmpfiles runs too late, after journald has already started, so if tmpfiles creates the directory, it'll only be used after a reboot. This probably could be made to work by adding a new service to flush the journal, but that becomes complicated and we lose the main advantage of simplicity.) Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1387796.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<!ENTITY FALLBACK_HOSTNAME "{{FALLBACK_HOSTNAME}}">
|
||||
<!ENTITY MEMORY_ACCOUNTING_DEFAULT "{{ 'yes' if MEMORY_ACCOUNTING_DEFAULT else 'no' }}">
|
||||
<!ENTITY KILL_USER_PROCESSES "{{ 'yes' if KILL_USER_PROCESSES else 'no' }}">
|
||||
<!ENTITY JOURNAL_STORAGE_DEFAULT "{{JOURNAL_STORAGE_DEFAULT}}">
|
||||
<!ENTITY DEBUGTTY "{{DEBUGTTY}}">
|
||||
<!ENTITY SYSTEM_SYSVRCLOCAL_PATH "{{SYSTEM_SYSVRCLOCAL_PATH}}">
|
||||
<!ENTITY HIGH_RLIMIT_NOFILE "{{HIGH_RLIMIT_NOFILE}}">
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version='1.0'?> <!--*-nxml-*-->
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % entities SYSTEM "custom-entities.ent" >
|
||||
%entities;
|
||||
]>
|
||||
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
|
||||
|
||||
<refentry id="journald.conf"
|
||||
@@ -82,8 +85,9 @@
|
||||
<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>
|
||||
the kernel log buffer, or a syslog socket will still work). Defaults to
|
||||
<literal>&JOURNAL_STORAGE_DEFAULT;</literal> in the default journal namespace (this value is
|
||||
determined at compilation time), and <literal>persistent</literal> in all others.</para>
|
||||
|
||||
<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
|
||||
|
||||
@@ -117,6 +117,9 @@ conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
|
||||
conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
|
||||
conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
|
||||
|
||||
conf.set('JOURNAL_STORAGE_DEFAULT', get_option('journal-storage-default'))
|
||||
conf.set('JOURNAL_STORAGE_DEFAULT_VAL', 'STORAGE_' + get_option('journal-storage-default').to_upper())
|
||||
|
||||
# Meson ignores the preceding arguments when joining paths if an absolute
|
||||
# component is encountered, so this should canonicalize various paths when they
|
||||
# are absolute or relative.
|
||||
@@ -3096,6 +3099,7 @@ summary({
|
||||
'default locale' : default_locale,
|
||||
'default nspawn locale' : nspawn_locale,
|
||||
'default status unit format' : status_unit_format_default,
|
||||
'default journal storage mode' : conf.get('JOURNAL_STORAGE_DEFAULT'),
|
||||
'default user $PATH' : default_user_path != '' ? default_user_path : '(same as system services)',
|
||||
'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
|
||||
'time epoch' : f'@time_epoch@ (@alt_time_epoch@)',
|
||||
|
||||
@@ -139,6 +139,8 @@ option('timedated', type : 'boolean',
|
||||
description : 'install the systemd-timedated daemon')
|
||||
option('timesyncd', type : 'boolean',
|
||||
description : 'install the systemd-timesyncd daemon')
|
||||
option('journal-storage-default', type : 'combo', choices : ['auto', 'volatile', 'persistent', 'none'],
|
||||
description : 'default storage mode for journald (main namespace)')
|
||||
option('remote', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||
description : 'support for "journal over the network"')
|
||||
option('create-log-dirs', type : 'boolean',
|
||||
|
||||
@@ -116,7 +116,7 @@ void manager_merge_configs(Manager *m) {
|
||||
|
||||
journal_config_done(&m->config);
|
||||
|
||||
MERGE_NON_NEGATIVE(storage, STORAGE_AUTO);
|
||||
MERGE_NON_NEGATIVE(storage, JOURNAL_STORAGE_DEFAULT_VAL);
|
||||
manager_merge_journal_compress_options(m);
|
||||
MERGE_NON_NEGATIVE(seal, true);
|
||||
/* By default, /dev/kmsg is read only by the main namespace instance. */
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# See journald.conf(5) for details.
|
||||
|
||||
[Journal]
|
||||
#Storage=auto
|
||||
#Storage={{ JOURNAL_STORAGE_DEFAULT }}
|
||||
#Compress=yes
|
||||
#Seal=yes
|
||||
#SplitMode=uid
|
||||
|
||||
Reference in New Issue
Block a user