diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2023-10-03 11:26:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-03 11:26:52 +0300 |
commit | f4a44dfaa5cd302c852fffc3d3397475eb885de6 (patch) | |
tree | 5d92945d7f72399b2e0cdf9ed34fa5507447e738 /libnetdata | |
parent | 69a663a21da1bbace2179860871a53d99c801cf7 (diff) |
external plugins: respect env NETDATA_LOG_SEVERITY_LEVEL (#16089)
* func to set global log sev level for ext plugins
* apps: set log sev level
* cgroup-network: set log sev level
* cups: set log sev level
* debugfs: set log sev level
* freeipmi: set log sev level
* nfacct: set log sev level
* perf: set log sev level
* slabinfo: set log sev level
* xenstat: set log sev level
* cgroup-name.sh: handle log sev level
* alarm-notify.sh: handle log sev level
* systemd-journal: set log sev e level
* ebpf.plugin: set log sev level
* ioping: handle log sev level
* cgroup-network-helper.sh: handle log sev level
* fix for cgroup-network-helper.sh
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/log/log.c | 8 | ||||
-rw-r--r-- | libnetdata/log/log.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/libnetdata/log/log.c b/libnetdata/log/log.c index e7fe81160a..60d13f3b08 100644 --- a/libnetdata/log/log.c +++ b/libnetdata/log/log.c @@ -1163,3 +1163,11 @@ char *log_severity_level_to_severity_string(netdata_log_level_t level) return NETDATA_LOG_LEVEL_INFO_STR; } } + +void log_set_global_severity_for_external_plugins() { + char *s = getenv("NETDATA_LOG_SEVERITY_LEVEL"); + if (!s) + return; + netdata_log_level_t level = log_severity_string_to_severity_level(s); + log_set_global_severity_level(level); +} diff --git a/libnetdata/log/log.h b/libnetdata/log/log.h index 38aa2cbf54..7e71550cbe 100644 --- a/libnetdata/log/log.h +++ b/libnetdata/log/log.h @@ -120,6 +120,7 @@ extern netdata_log_level_t global_log_severity_level; netdata_log_level_t log_severity_string_to_severity_level(char *level); char *log_severity_level_to_severity_string(netdata_log_level_t level); void log_set_global_severity_level(netdata_log_level_t value); +void log_set_global_severity_for_external_plugins(); #define error_limit_static_global_var(var, log_every_secs, sleep_usecs) static ERROR_LIMIT var = { .last_logged = 0, .count = 0, .log_every = (log_every_secs), .sleep_ut = (sleep_usecs) } #define error_limit_static_thread_var(var, log_every_secs, sleep_usecs) static __thread ERROR_LIMIT var = { .last_logged = 0, .count = 0, .log_every = (log_every_secs), .sleep_ut = (sleep_usecs) } |