summaryrefslogtreecommitdiff
path: root/src/journal/journald-context.c
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-10-21 15:47:58 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-10 17:51:05 +0100
commit8522691d4dafda542a65b1113128ac7d689302ac (patch)
tree74b96a8580e7fe5670fb4b7fd1e8a44820b3a3de /src/journal/journald-context.c
parent2199ff901855afe0045d67f5bb2aba87c081bd7d (diff)
downloadsystemd-8522691d4dafda542a65b1113128ac7d689302ac.tar.gz
journal: Ratelimit more journald log messages
systemd-journald is prone to spamming logs if the system gets into a messy state. Let's improve the situation by ratelimiting logs on the hot code paths to 3 times per minute.
Diffstat (limited to 'src/journal/journald-context.c')
-rw-r--r--src/journal/journald-context.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/journal/journald-context.c b/src/journal/journald-context.c
index 27608ff089..6d58422ddd 100644
--- a/src/journal/journald-context.c
+++ b/src/journal/journald-context.c
@@ -771,7 +771,8 @@ void client_context_acquire_default(Server *s) {
r = client_context_acquire(s, ucred.pid, &ucred, NULL, 0, NULL, &s->my_context);
if (r < 0)
- log_warning_errno(r, "Failed to acquire our own context, ignoring: %m");
+ log_ratelimit_warning_errno(r, JOURNALD_LOG_RATELIMIT,
+ "Failed to acquire our own context, ignoring: %m");
}
if (!s->namespace && !s->pid1_context) {
@@ -780,7 +781,8 @@ void client_context_acquire_default(Server *s) {
r = client_context_acquire(s, 1, NULL, NULL, 0, NULL, &s->pid1_context);
if (r < 0)
- log_warning_errno(r, "Failed to acquire PID1's context, ignoring: %m");
+ log_ratelimit_warning_errno(r, JOURNALD_LOG_RATELIMIT,
+ "Failed to acquire PID1's context, ignoring: %m");
}
}