diff options
author | Quentin Deslandes <qde@naccy.de> | 2022-09-13 17:15:13 +0200 |
---|---|---|
committer | Quentin Deslandes <qde@naccy.de> | 2022-12-15 10:57:39 +0100 |
commit | 87a13dabbd81c2e31fd5ac7b81cce61baf23e59c (patch) | |
tree | 83b4ddf0c6602b544ccf97a5110586760b1a5c25 /src/journal/journald-context.c | |
parent | Create hash_ops structure to free keys of type pcre2_code (diff) | |
download | systemd-87a13dabbd81c2e31fd5ac7b81cce61baf23e59c.tar.xz systemd-87a13dabbd81c2e31fd5ac7b81cce61baf23e59c.zip |
journal: filter log based on LogFilterPatterns
Use LogFilterPatterns from the unit's cgroup xattr in order to keep or
discard log messages before writing them to the journal.
When a log message is discarded, it won't be written to syslog, console...
either.
When a native, syslog, or standard output log message is received,
systemd-journald will process it if it matches against at least one
allowed pattern (if any) and none of the denied patterns (if any).
Diffstat (limited to 'src/journal/journald-context.c')
-rw-r--r-- | src/journal/journald-context.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/journal/journald-context.c b/src/journal/journald-context.c index 222855ae60..55e657c7e1 100644 --- a/src/journal/journald-context.c +++ b/src/journal/journald-context.c @@ -14,6 +14,7 @@ #include "io-util.h" #include "journal-internal.h" #include "journal-util.h" +#include "journald-client.h" #include "journald-context.h" #include "parse-util.h" #include "path-util.h" @@ -180,6 +181,9 @@ static void client_context_reset(Server *s, ClientContext *c) { c->log_ratelimit_interval = s->ratelimit_interval; c->log_ratelimit_burst = s->ratelimit_burst; + + c->log_filter_allowed_patterns = set_free(c->log_filter_allowed_patterns); + c->log_filter_denied_patterns = set_free(c->log_filter_denied_patterns); } static ClientContext* client_context_free(Server *s, ClientContext *c) { @@ -290,6 +294,8 @@ static int client_context_read_cgroup(Server *s, ClientContext *c, const char *u return r; } + (void) client_context_read_log_filter_patterns(c, t); + /* Let's shortcut this if the cgroup path didn't change */ if (streq_ptr(c->cgroup, t)) return 0; |