mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
journald: make splitting up of journal files per-user configurable
This commit is contained in:
parent
a1a03e3075
commit
182b858fc2
@ -135,6 +135,36 @@
|
|||||||
enabled.</para></listitem>
|
enabled.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>SplitMode=</varname></term>
|
||||||
|
|
||||||
|
<listitem><para>Controls whether to
|
||||||
|
split up journal files per user. One
|
||||||
|
of <literal>login</literal>,
|
||||||
|
<literal>uid</literal> and
|
||||||
|
<literal>none</literal>. If
|
||||||
|
<literal>login</literal> each logged
|
||||||
|
in user will get his own journal
|
||||||
|
files, but systemd user IDs will log
|
||||||
|
into the system journal. If
|
||||||
|
<literal>uid</literal> any user ID
|
||||||
|
will get his own journal files
|
||||||
|
regardless whether it belongs to a
|
||||||
|
system service or refers to a real
|
||||||
|
logged in user. If
|
||||||
|
<literal>none</literal> journal files
|
||||||
|
are not split up per-user and all
|
||||||
|
messages are stored in the single
|
||||||
|
system journal. Note that splitting
|
||||||
|
up journal files per-user is only
|
||||||
|
available of journals are stored
|
||||||
|
persistently. If journals are stored
|
||||||
|
on volatile storage (see above) only a
|
||||||
|
single journal file for all user IDs
|
||||||
|
is kept. Defaults to
|
||||||
|
<literal>login</literal>.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>RateLimitInterval=</varname></term>
|
<term><varname>RateLimitInterval=</varname></term>
|
||||||
<term><varname>RateLimitBurst=</varname></term>
|
<term><varname>RateLimitBurst=</varname></term>
|
||||||
|
@ -36,3 +36,4 @@ Journal.MaxLevelStore, config_parse_level, 0, offsetof(Server, max_leve
|
|||||||
Journal.MaxLevelSyslog, config_parse_level, 0, offsetof(Server, max_level_syslog)
|
Journal.MaxLevelSyslog, config_parse_level, 0, offsetof(Server, max_level_syslog)
|
||||||
Journal.MaxLevelKMsg, config_parse_level, 0, offsetof(Server, max_level_kmsg)
|
Journal.MaxLevelKMsg, config_parse_level, 0, offsetof(Server, max_level_kmsg)
|
||||||
Journal.MaxLevelConsole, config_parse_level, 0, offsetof(Server, max_level_console)
|
Journal.MaxLevelConsole, config_parse_level, 0, offsetof(Server, max_level_console)
|
||||||
|
Journal.SplitMode, config_parse_split_mode,0, offsetof(Server, split_mode)
|
||||||
|
@ -87,6 +87,15 @@ static const char* const storage_table[] = {
|
|||||||
DEFINE_STRING_TABLE_LOOKUP(storage, Storage);
|
DEFINE_STRING_TABLE_LOOKUP(storage, Storage);
|
||||||
DEFINE_CONFIG_PARSE_ENUM(config_parse_storage, storage, Storage, "Failed to parse storage setting");
|
DEFINE_CONFIG_PARSE_ENUM(config_parse_storage, storage, Storage, "Failed to parse storage setting");
|
||||||
|
|
||||||
|
static const char* const split_mode_table[] = {
|
||||||
|
[SPLIT_NONE] = "none",
|
||||||
|
[SPLIT_UID] = "uid",
|
||||||
|
[SPLIT_LOGIN] = "login"
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_STRING_TABLE_LOOKUP(split_mode, SplitMode);
|
||||||
|
DEFINE_CONFIG_PARSE_ENUM(config_parse_split_mode, split_mode, SplitMode, "Failed to parse split mode setting");
|
||||||
|
|
||||||
static uint64_t available_space(Server *s) {
|
static uint64_t available_space(Server *s) {
|
||||||
char ids[33], *p;
|
char ids[33], *p;
|
||||||
const char *f;
|
const char *f;
|
||||||
@ -659,7 +668,10 @@ static void dispatch_message_real(
|
|||||||
|
|
||||||
assert(n <= m);
|
assert(n <= m);
|
||||||
|
|
||||||
write_to_journal(s, realuid == 0 ? 0 : loginuid, iovec, n);
|
write_to_journal(s,
|
||||||
|
s->split_mode == SPLIT_NONE ? 0 :
|
||||||
|
(s->split_mode == SPLIT_UID ? realuid :
|
||||||
|
(realuid == 0 ? 0 : loginuid)), iovec, n);
|
||||||
|
|
||||||
free(pid);
|
free(pid);
|
||||||
free(uid);
|
free(uid);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#Storage=auto
|
#Storage=auto
|
||||||
#Compress=yes
|
#Compress=yes
|
||||||
#Seal=yes
|
#Seal=yes
|
||||||
|
#SplitMode=login
|
||||||
#RateLimitInterval=10s
|
#RateLimitInterval=10s
|
||||||
#RateLimitBurst=200
|
#RateLimitBurst=200
|
||||||
#SystemMaxUse=
|
#SystemMaxUse=
|
||||||
|
@ -41,6 +41,14 @@ typedef enum Storage {
|
|||||||
_STORAGE_INVALID = -1
|
_STORAGE_INVALID = -1
|
||||||
} Storage;
|
} Storage;
|
||||||
|
|
||||||
|
typedef enum SplitMode {
|
||||||
|
SPLIT_LOGIN,
|
||||||
|
SPLIT_UID,
|
||||||
|
SPLIT_NONE,
|
||||||
|
_SPLIT_MAX,
|
||||||
|
_SPLIT_INVALID = -1
|
||||||
|
} SplitMode;
|
||||||
|
|
||||||
typedef struct StdoutStream StdoutStream;
|
typedef struct StdoutStream StdoutStream;
|
||||||
|
|
||||||
typedef struct Server {
|
typedef struct Server {
|
||||||
@ -93,6 +101,7 @@ typedef struct Server {
|
|||||||
int max_level_console;
|
int max_level_console;
|
||||||
|
|
||||||
Storage storage;
|
Storage storage;
|
||||||
|
SplitMode split_mode;
|
||||||
|
|
||||||
MMapCache *mmap;
|
MMapCache *mmap;
|
||||||
|
|
||||||
@ -117,3 +126,8 @@ int config_parse_storage(const char *filename, unsigned line, const char *sectio
|
|||||||
|
|
||||||
const char *storage_to_string(Storage s);
|
const char *storage_to_string(Storage s);
|
||||||
Storage storage_from_string(const char *s);
|
Storage storage_from_string(const char *s);
|
||||||
|
|
||||||
|
int config_parse_split_mode(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
||||||
|
|
||||||
|
const char *split_mode_to_string(SplitMode s);
|
||||||
|
SplitMode split_mode_from_string(const char *s);
|
||||||
|
Loading…
Reference in New Issue
Block a user