mirror of
https://github.com/netdata/netdata.git
synced 2025-04-28 14:42:31 +00:00
fix verify_netdata_host_prefix log spam (#16814)
This commit is contained in:
parent
b9a6eddd1d
commit
4b5453e197
9 changed files with 15 additions and 12 deletions
collectors
apps.plugin
cgroups.plugin
debugfs.plugin
ebpf.plugin
systemd-journal.plugin
daemon
libnetdata
logsmanagement
|
@ -5270,7 +5270,7 @@ int main(int argc, char **argv) {
|
|||
procfile_open_flags = O_RDONLY|O_NOFOLLOW;
|
||||
|
||||
netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX");
|
||||
if(verify_netdata_host_prefix() == -1) exit(1);
|
||||
if(verify_netdata_host_prefix(true) == -1) exit(1);
|
||||
|
||||
user_config_dir = getenv("NETDATA_USER_CONFIG_DIR");
|
||||
if(user_config_dir == NULL) {
|
||||
|
|
|
@ -666,7 +666,7 @@ int main(int argc, char **argv) {
|
|||
// make sure NETDATA_HOST_PREFIX is safe
|
||||
|
||||
netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX");
|
||||
if(verify_netdata_host_prefix() == -1) exit(1);
|
||||
if(verify_netdata_host_prefix(false) == -1) exit(1);
|
||||
|
||||
if(netdata_configured_host_prefix[0] != '\0' && verify_path(netdata_configured_host_prefix) == -1)
|
||||
fatal("invalid NETDATA_HOST_PREFIX '%s'", netdata_configured_host_prefix);
|
||||
|
|
|
@ -163,7 +163,7 @@ int main(int argc, char **argv)
|
|||
nd_log_initialize_for_external_plugins("debugfs.plugin");
|
||||
|
||||
netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX");
|
||||
if (verify_netdata_host_prefix() == -1)
|
||||
if (verify_netdata_host_prefix(true) == -1)
|
||||
exit(1);
|
||||
|
||||
user_config_dir = getenv("NETDATA_USER_CONFIG_DIR");
|
||||
|
|
|
@ -4031,7 +4031,7 @@ int main(int argc, char **argv)
|
|||
ebpf_start_pthread_variables();
|
||||
|
||||
netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX");
|
||||
if(verify_netdata_host_prefix() == -1) ebpf_exit(6);
|
||||
if(verify_netdata_host_prefix(true) == -1) ebpf_exit(6);
|
||||
|
||||
ebpf_allocate_common_vectors();
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ int main(int argc __maybe_unused, char **argv __maybe_unused) {
|
|||
nd_log_initialize_for_external_plugins("systemd-journal.plugin");
|
||||
|
||||
netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX");
|
||||
if(verify_netdata_host_prefix() == -1) exit(1);
|
||||
if(verify_netdata_host_prefix(true) == -1) exit(1);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
|
|
|
@ -1116,7 +1116,7 @@ static void get_netdata_configured_variables() {
|
|||
// get the hostname
|
||||
|
||||
netdata_configured_host_prefix = config_get(CONFIG_SECTION_GLOBAL, "host access prefix", "");
|
||||
verify_netdata_host_prefix();
|
||||
verify_netdata_host_prefix(true);
|
||||
|
||||
char buf[HOSTNAME_MAX + 1];
|
||||
if (get_hostname(buf, HOSTNAME_MAX))
|
||||
|
|
|
@ -1329,7 +1329,7 @@ static int is_virtual_filesystem(const char *path, char **reason) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int verify_netdata_host_prefix() {
|
||||
int verify_netdata_host_prefix(bool log_msg) {
|
||||
if(!netdata_configured_host_prefix)
|
||||
netdata_configured_host_prefix = "";
|
||||
|
||||
|
@ -1362,13 +1362,16 @@ int verify_netdata_host_prefix() {
|
|||
if(is_virtual_filesystem(path, &reason) == -1)
|
||||
goto failed;
|
||||
|
||||
if(netdata_configured_host_prefix && *netdata_configured_host_prefix)
|
||||
netdata_log_info("Using host prefix directory '%s'", netdata_configured_host_prefix);
|
||||
if (netdata_configured_host_prefix && *netdata_configured_host_prefix) {
|
||||
if (log_msg)
|
||||
netdata_log_info("Using host prefix directory '%s'", netdata_configured_host_prefix);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
failed:
|
||||
netdata_log_error("Ignoring host prefix '%s': path '%s' %s", netdata_configured_host_prefix, path, reason);
|
||||
if (log_msg)
|
||||
netdata_log_error("Ignoring host prefix '%s': path '%s' %s", netdata_configured_host_prefix, path, reason);
|
||||
netdata_configured_host_prefix = "";
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -559,7 +559,7 @@ extern int enable_ksm;
|
|||
|
||||
char *fgets_trim_len(char *buf, size_t buf_size, FILE *fp, size_t *len);
|
||||
|
||||
int verify_netdata_host_prefix();
|
||||
int verify_netdata_host_prefix(bool log_msg);
|
||||
|
||||
extern volatile sig_atomic_t netdata_exit;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ int main(int argc, char **argv) {
|
|||
nd_log_initialize_for_external_plugins(program_name);
|
||||
|
||||
// netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX");
|
||||
// if(verify_netdata_host_prefix() == -1) exit(1);
|
||||
// if(verify_netdata_host_prefix(true) == -1) exit(1);
|
||||
|
||||
int g_update_every = 0;
|
||||
for(int i = 1; i < argc ; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue