@cryptotaxi247 / netdata-1 / commits / f672f4a95

Rename log Macros (debug) (#15322)

thiagoftsm committed Jul 11, 2023 at 14:45 UTC f672f4a95584da2a9978f5dca11eba34dc8a8c3b
73 files changed +677 -676
aclk/aclk.c
+3 -3
@@ -110,7 +110,7 @@ static int load_private_key()
110 netdata_log_error("Claimed agent cannot establish ACLK - unable to load private key '%s' failed.", filename);
111 return 1;
112 }
113 - debug(D_ACLK, "Claimed agent loaded private key len=%ld bytes", bytes_read);
113 + netdata_log_debug(D_ACLK, "Claimed agent loaded private key len=%ld bytes", bytes_read);
114
115 BIO *key_bio = BIO_new_mem_buf(private_key, -1);
116 if (key_bio==NULL) {
@@ -240,7 +240,7 @@ void aclk_mqtt_wss_log_cb(mqtt_wss_log_type_t log_type, const char* str)
240 netdata_log_info("%s", str);
241 return;
242 case MQTT_WSS_LOG_DEBUG:
243 - debug(D_ACLK, "%s", str);
243 + netdata_log_debug(D_ACLK, "%s", str);
244 return;
245 default:
246 netdata_log_error("Unknown log type from mqtt_wss");
@@ -252,7 +252,7 @@ static void msg_callback(const char *topic, const void *msg, size_t msglen, int
252 UNUSED(qos);
253 aclk_rcvd_cloud_msgs++;
254
255 - debug(D_ACLK, "Got Message From Broker Topic \"%s\" QOS %d", topic, qos);
255 + netdata_log_debug(D_ACLK, "Got Message From Broker Topic \"%s\" QOS %d", topic, qos);
256
257 if (aclk_shared_state.mqtt_shutdown_msg_id > 0) {
258 netdata_log_error("Link is shutting down. Ignoring incoming message.");
aclk/aclk_query.c
+2 -2
@@ -286,10 +286,10 @@ static void aclk_query_process_msg(struct aclk_query_thread *query_thr, aclk_que
286
287 worker_is_busy(query->type);
288 if (query->type == HTTP_API_V2) {
289 - debug(D_ACLK, "Processing Queued Message of type: \"http_api_request_v2\"");
289 + netdata_log_debug(D_ACLK, "Processing Queued Message of type: \"http_api_request_v2\"");
290 http_api_v2(query_thr, query);
291 } else {
292 - debug(D_ACLK, "Processing Queued Message of type: \"%s\"", query->data.bin_payload.msg_name);
292 + netdata_log_debug(D_ACLK, "Processing Queued Message of type: \"%s\"", query->data.bin_payload.msg_name);
293 send_bin_msg(query_thr, query);
294 }
295
aclk/aclk_rx_msgs.c
+3 -3
@@ -180,7 +180,7 @@ int aclk_handle_cloud_cmd_message(char *payload)
180 return 1;
181 }
182
183 - debug(D_ACLK, "ACLK incoming 'cmd' message (%s)", payload);
183 + netdata_log_debug(D_ACLK, "ACLK incoming 'cmd' message (%s)", payload);
184
185 int rc = json_parse(payload, &cloud_to_agent, cloud_to_agent_parse);
186
@@ -250,7 +250,7 @@ int create_node_instance_result(const char *msg, size_t msg_len)
250 return 1;
251 }
252
253 - debug(D_ACLK, "CreateNodeInstanceResult: guid:%s nodeid:%s", res.machine_guid, res.node_id);
253 + netdata_log_debug(D_ACLK, "CreateNodeInstanceResult: guid:%s nodeid:%s", res.machine_guid, res.node_id);
254
255 uuid_t host_id, node_id;
256 if (uuid_parse(res.machine_guid, host_id)) {
@@ -529,7 +529,7 @@ void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t
529 ACLK_STATS_UNLOCK;
530 }
531 new_cloud_rx_msg_t *msg_descriptor = find_rx_handler_by_hash(simple_hash(message_type));
532 - debug(D_ACLK, "Got message named '%s' from cloud", message_type);
532 + netdata_log_debug(D_ACLK, "Got message named '%s' from cloud", message_type);
533 if (unlikely(!msg_descriptor)) {
534 netdata_log_error("Do not know how to handle message of type '%s'. Ignoring", message_type);
535 if (aclk_stats_enabled) {
aclk/aclk_util.c
+1 -1
@@ -219,7 +219,7 @@ static int topic_cache_add_topic(struct json_object *json, struct aclk_topic *to
219 }
220 topic->topic_id = topic_name_to_id(json_object_get_string(json_object_iter_peek_value(&it)));
221 if (topic->topic_id == ACLK_TOPICID_UNKNOWN) {
222 - debug(D_ACLK, "topic dictionary has unknown topic name \"%s\"", json_object_get_string(json_object_iter_peek_value(&it)));
222 + netdata_log_debug(D_ACLK, "topic dictionary has unknown topic name \"%s\"", json_object_get_string(json_object_iter_peek_value(&it)));
223 }
224 json_object_iter_next(&it);
225 continue;
collectors/cgroups.plugin/sys_fs_cgroup.c
+97 -95
@@ -427,10 +427,12 @@ void read_cgroup_plugin_configuration() {
427
428 //TODO: can there be more than 1 cgroup2 mount point?
429 mi = mountinfo_find_by_filesystem_super_option(root, "cgroup2", "rw"); //there is no cgroup2 specific super option - for now use 'rw' option
430 - if(mi) debug(D_CGROUP, "found unified cgroup root using super options, with path: '%s'", mi->mount_point);
430 + if(mi)
431 + netdata_log_debug(D_CGROUP, "found unified cgroup root using super options, with path: '%s'", mi->mount_point);
432 if(!mi) {
433 mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup2", "cgroup");
433 - if(mi) debug(D_CGROUP, "found unified cgroup root using mountsource info, with path: '%s'", mi->mount_point);
434 + if(mi)
435 + netdata_log_debug(D_CGROUP, "found unified cgroup root using mountsource info, with path: '%s'", mi->mount_point);
436 }
437 if(!mi) {
438 collector_error("CGROUP: cannot find cgroup2 mountinfo. Assuming default: /sys/fs/cgroup");
@@ -439,7 +441,7 @@ void read_cgroup_plugin_configuration() {
441 else s = mi->mount_point;
442 set_cgroup_base_path(filename, s);
443 cgroup_unified_base = config_get("plugin:cgroups", "path to unified cgroups", filename);
442 - debug(D_CGROUP, "using cgroup root: '%s'", cgroup_unified_base);
444 + netdata_log_debug(D_CGROUP, "using cgroup root: '%s'", cgroup_unified_base);
445 }
446
447 cgroup_root_max = (int)config_get_number("plugin:cgroups", "max cgroups to allow", cgroup_root_max);
@@ -982,13 +984,13 @@ static int k8s_get_container_first_proc_comm(const char *id, char *comm) {
984
985 ff = procfile_reopen(ff, filename, NULL, CGROUP_PROCFILE_FLAG);
986 if (unlikely(!ff)) {
985 - debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename);
987 + netdata_log_debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename);
988 return 1;
989 }
990
991 ff = procfile_readall(ff);
992 if (unlikely(!ff)) {
991 - debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot read file '%s'.", filename);
993 + netdata_log_debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot read file '%s'.", filename);
994 return 1;
995 }
996
@@ -1006,13 +1008,13 @@ static int k8s_get_container_first_proc_comm(const char *id, char *comm) {
1008
1009 ff = procfile_reopen(ff, filename, NULL, PROCFILE_FLAG_DEFAULT);
1010 if (unlikely(!ff)) {
1009 - debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename);
1011 + netdata_log_debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename);
1012 return 1;
1013 }
1014
1015 ff = procfile_readall(ff);
1016 if (unlikely(!ff)) {
1015 - debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot read file '%s'.", filename);
1017 + netdata_log_debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot read file '%s'.", filename);
1018 return 1;
1019 }
1020
@@ -1612,7 +1614,7 @@ memory_next:
1614 }
1615
1616 static inline void read_cgroup(struct cgroup *cg) {
1615 - debug(D_CGROUP, "reading metrics for cgroups '%s'", cg->id);
1617 + netdata_log_debug(D_CGROUP, "reading metrics for cgroups '%s'", cg->id);
1618 if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) {
1619 cgroup_read_cpuacct_stat(&cg->cpuacct_stat);
1620 cgroup_read_cpuacct_usage(&cg->cpuacct_usage);
@@ -1640,7 +1642,7 @@ static inline void read_cgroup(struct cgroup *cg) {
1642 }
1643
1644 static inline void read_all_discovered_cgroups(struct cgroup *root) {
1643 - debug(D_CGROUP, "reading metrics for all cgroups");
1645 + netdata_log_debug(D_CGROUP, "reading metrics for all cgroups");
1646
1647 struct cgroup *cg;
1648 for (cg = root; cg; cg = cg->next) {
@@ -1655,7 +1657,7 @@ static inline void read_all_discovered_cgroups(struct cgroup *root) {
1657
1658 #define CGROUP_NETWORK_INTERFACE_MAX_LINE 2048
1659 static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
1658 - debug(D_CGROUP, "looking for the network interfaces of cgroup '%s' with chart id '%s' and title '%s'", cg->id, cg->chart_id, cg->chart_title);
1660 + netdata_log_debug(D_CGROUP, "looking for the network interfaces of cgroup '%s' with chart id '%s' and title '%s'", cg->id, cg->chart_id, cg->chart_title);
1661
1662 pid_t cgroup_pid;
1663 char cgroup_identifier[CGROUP_NETWORK_INTERFACE_MAX_LINE + 1];
@@ -1667,7 +1669,7 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
1669 snprintfz(cgroup_identifier, CGROUP_NETWORK_INTERFACE_MAX_LINE, "%s%s", cgroup_unified_base, cg->id);
1670 }
1671
1670 - debug(D_CGROUP, "executing cgroup_identifier %s --cgroup '%s' for cgroup '%s'", cgroups_network_interface_script, cgroup_identifier, cg->id);
1672 + netdata_log_debug(D_CGROUP, "executing cgroup_identifier %s --cgroup '%s' for cgroup '%s'", cgroups_network_interface_script, cgroup_identifier, cg->id);
1673 FILE *fp_child_input, *fp_child_output;
1674 (void)netdata_popen_raw_default_flags_and_environment(&cgroup_pid, &fp_child_input, &fp_child_output, cgroups_network_interface_script, "--cgroup", cgroup_identifier);
1675 if(!fp_child_output) {
@@ -1713,7 +1715,7 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
1715 }
1716
1717 netdata_pclose(fp_child_input, fp_child_output, cgroup_pid);
1716 - // debug(D_CGROUP, "closed cgroup_identifier for cgroup '%s'", cg->id);
1718 + // netdata_log_debug(D_CGROUP, "closed cgroup_identifier for cgroup '%s'", cg->id);
1719 }
1720
1721 static inline void free_cgroup_network_interfaces(struct cgroup *cg) {
@@ -1793,7 +1795,7 @@ static inline void free_pressure(struct pressure *res) {
1795 }
1796
1797 static inline void cgroup_free(struct cgroup *cg) {
1796 - debug(D_CGROUP, "Removing cgroup '%s' with chart id '%s' (was %s and %s)", cg->id, cg->chart_id, (cg->enabled)?"enabled":"disabled", (cg->available)?"available":"not available");
1798 + netdata_log_debug(D_CGROUP, "Removing cgroup '%s' with chart id '%s' (was %s and %s)", cg->id, cg->chart_id, (cg->enabled)?"enabled":"disabled", (cg->available)?"available":"not available");
1799
1800 if(cg->st_cpu) rrdset_is_obsolete(cg->st_cpu);
1801 if(cg->st_cpu_limit) rrdset_is_obsolete(cg->st_cpu_limit);
@@ -1870,8 +1872,8 @@ static inline void discovery_rename_cgroup(struct cgroup *cg) {
1872 }
1873 cg->pending_renames--;
1874
1873 - debug(D_CGROUP, "looking for the name of cgroup '%s' with chart id '%s' and title '%s'", cg->id, cg->chart_id, cg->chart_title);
1874 - debug(D_CGROUP, "executing command %s \"%s\" for cgroup '%s'", cgroups_rename_script, cg->intermediate_id, cg->chart_id);
1875 + netdata_log_debug(D_CGROUP, "looking for the name of cgroup '%s' with chart id '%s' and title '%s'", cg->id, cg->chart_id, cg->chart_title);
1876 + netdata_log_debug(D_CGROUP, "executing command %s \"%s\" for cgroup '%s'", cgroups_rename_script, cg->intermediate_id, cg->chart_id);
1877 pid_t cgroup_pid;
1878
1879 FILE *fp_child_input, *fp_child_output;
@@ -1984,7 +1986,7 @@ static inline void convert_cgroup_to_systemd_service(struct cgroup *cg) {
1986 }
1987
1988 static inline struct cgroup *discovery_cgroup_add(const char *id) {
1987 - debug(D_CGROUP, "adding to list, cgroup with id '%s'", id);
1989 + netdata_log_debug(D_CGROUP, "adding to list, cgroup with id '%s'", id);
1990
1991 struct cgroup *cg = callocz(1, sizeof(struct cgroup));
1992 cg->id = strdupz(id);
@@ -2011,7 +2013,7 @@ static inline struct cgroup *discovery_cgroup_add(const char *id) {
2013 }
2014
2015 static inline struct cgroup *discovery_cgroup_find(const char *id) {
2014 - debug(D_CGROUP, "searching for cgroup '%s'", id);
2016 + netdata_log_debug(D_CGROUP, "searching for cgroup '%s'", id);
2017
2018 uint32_t hash = simple_hash(id);
2019
@@ -2021,7 +2023,7 @@ static inline struct cgroup *discovery_cgroup_find(const char *id) {
2023 break;
2024 }
2025
2024 - debug(D_CGROUP, "cgroup '%s' %s in memory", id, (cg)?"found":"not found");
2026 + netdata_log_debug(D_CGROUP, "cgroup '%s' %s in memory", id, (cg)?"found":"not found");
2027 return cg;
2028 }
2029
@@ -2029,7 +2031,7 @@ static inline void discovery_find_cgroup_in_dir_callback(const char *dir) {
2031 if (!dir || !*dir) {
2032 dir = "/";
2033 }
2032 - debug(D_CGROUP, "examining cgroup dir '%s'", dir);
2034 + netdata_log_debug(D_CGROUP, "examining cgroup dir '%s'", dir);
2035
2036 struct cgroup *cg = discovery_cgroup_find(dir);
2037 if (cg) {
@@ -2058,7 +2060,7 @@ static inline void discovery_find_cgroup_in_dir_callback(const char *dir) {
2060
2061 static inline int discovery_find_dir_in_subdirs(const char *base, const char *this, void (*callback)(const char *)) {
2062 if(!this) this = base;
2061 - debug(D_CGROUP, "searching for directories in '%s' (base '%s')", this?this:"", base);
2063 + netdata_log_debug(D_CGROUP, "searching for directories in '%s' (base '%s')", this?this:"", base);
2064
2065 size_t dirlen = strlen(this), baselen = strlen(base);
2066
@@ -2112,7 +2114,7 @@ static inline int discovery_find_dir_in_subdirs(const char *base, const char *th
2114 }
2115
2116 static inline void discovery_mark_all_cgroups_as_unavailable() {
2115 - debug(D_CGROUP, "marking all cgroups as not available");
2117 + netdata_log_debug(D_CGROUP, "marking all cgroups as not available");
2118 struct cgroup *cg;
2119 for (cg = discovered_cgroup_root; cg; cg = cg->discovered_next) {
2120 cg->available = 0;
@@ -2126,7 +2128,7 @@ static inline void discovery_update_filenames() {
2128 if(unlikely(!cg->available || !cg->enabled || cg->pending_renames))
2129 continue;
2130
2129 - debug(D_CGROUP, "checking paths for cgroup '%s'", cg->id);
2131 + netdata_log_debug(D_CGROUP, "checking paths for cgroup '%s'", cg->id);
2132
2133 // check for newly added cgroups
2134 // and update the filenames they read
@@ -2143,10 +2145,10 @@ static inline void discovery_update_filenames() {
2145 cg->filename_cpu_cfs_period = strdupz(filename);
2146 snprintfz(filename, FILENAME_MAX, "%s%s/cpu.cfs_quota_us", cgroup_cpuacct_base, cg->id);
2147 cg->filename_cpu_cfs_quota = strdupz(filename);
2146 - debug(D_CGROUP, "cpuacct.stat filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_stat.filename);
2148 + netdata_log_debug(D_CGROUP, "cpuacct.stat filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_stat.filename);
2149 }
2150 else
2149 - debug(D_CGROUP, "cpuacct.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2151 + netdata_log_debug(D_CGROUP, "cpuacct.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2152 }
2153
2154 if(unlikely(cgroup_enable_cpuacct_usage && !cg->cpuacct_usage.filename && !is_cgroup_systemd_service(cg))) {
@@ -2154,20 +2156,20 @@ static inline void discovery_update_filenames() {
2156 if(likely(stat(filename, &buf) != -1)) {
2157 cg->cpuacct_usage.filename = strdupz(filename);
2158 cg->cpuacct_usage.enabled = cgroup_enable_cpuacct_usage;
2157 - debug(D_CGROUP, "cpuacct.usage_percpu filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_usage.filename);
2159 + netdata_log_debug(D_CGROUP, "cpuacct.usage_percpu filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_usage.filename);
2160 }
2161 else
2160 - debug(D_CGROUP, "cpuacct.usage_percpu file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2162 + netdata_log_debug(D_CGROUP, "cpuacct.usage_percpu file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2163 }
2164 if(unlikely(cgroup_enable_cpuacct_cpu_throttling && !cg->cpuacct_cpu_throttling.filename && !is_cgroup_systemd_service(cg))) {
2165 snprintfz(filename, FILENAME_MAX, "%s%s/cpu.stat", cgroup_cpuacct_base, cg->id);
2166 if(likely(stat(filename, &buf) != -1)) {
2167 cg->cpuacct_cpu_throttling.filename = strdupz(filename);
2168 cg->cpuacct_cpu_throttling.enabled = cgroup_enable_cpuacct_cpu_throttling;
2167 - debug(D_CGROUP, "cpu.stat filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_throttling.filename);
2169 + netdata_log_debug(D_CGROUP, "cpu.stat filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_throttling.filename);
2170 }
2171 else
2170 - debug(D_CGROUP, "cpu.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2172 + netdata_log_debug(D_CGROUP, "cpu.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2173 }
2174 if (unlikely(
2175 cgroup_enable_cpuacct_cpu_shares && !cg->cpuacct_cpu_shares.filename &&
@@ -2176,10 +2178,10 @@ static inline void discovery_update_filenames() {
2178 if (likely(stat(filename, &buf) != -1)) {
2179 cg->cpuacct_cpu_shares.filename = strdupz(filename);
2180 cg->cpuacct_cpu_shares.enabled = cgroup_enable_cpuacct_cpu_shares;
2179 - debug(
2181 + netdata_log_debug(
2182 D_CGROUP, "cpu.shares filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_shares.filename);
2183 } else
2182 - debug(D_CGROUP, "cpu.shares file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2184 + netdata_log_debug(D_CGROUP, "cpu.shares file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2185 }
2186
2187 if(unlikely((cgroup_enable_detailed_memory || cgroup_used_memory) && !cg->memory.filename_detailed && (cgroup_used_memory || cgroup_enable_systemd_services_detailed_memory || !is_cgroup_systemd_service(cg)))) {
@@ -2187,10 +2189,10 @@ static inline void discovery_update_filenames() {
2189 if(likely(stat(filename, &buf) != -1)) {
2190 cg->memory.filename_detailed = strdupz(filename);
2191 cg->memory.enabled_detailed = (cgroup_enable_detailed_memory == CONFIG_BOOLEAN_YES)?CONFIG_BOOLEAN_YES:CONFIG_BOOLEAN_AUTO;
2190 - debug(D_CGROUP, "memory.stat filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_detailed);
2192 + netdata_log_debug(D_CGROUP, "memory.stat filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_detailed);
2193 }
2194 else
2193 - debug(D_CGROUP, "memory.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2195 + netdata_log_debug(D_CGROUP, "memory.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2196 }
2197
2198 if(unlikely(cgroup_enable_memory && !cg->memory.filename_usage_in_bytes)) {
@@ -2198,12 +2200,12 @@ static inline void discovery_update_filenames() {
2200 if(likely(stat(filename, &buf) != -1)) {
2201 cg->memory.filename_usage_in_bytes = strdupz(filename);
2202 cg->memory.enabled_usage_in_bytes = cgroup_enable_memory;
2201 - debug(D_CGROUP, "memory.usage_in_bytes filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_usage_in_bytes);
2203 + netdata_log_debug(D_CGROUP, "memory.usage_in_bytes filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_usage_in_bytes);
2204 snprintfz(filename, FILENAME_MAX, "%s%s/memory.limit_in_bytes", cgroup_memory_base, cg->id);
2205 cg->filename_memory_limit = strdupz(filename);
2206 }
2207 else
2206 - debug(D_CGROUP, "memory.usage_in_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2208 + netdata_log_debug(D_CGROUP, "memory.usage_in_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2209 }
2210
2211 if(unlikely(cgroup_enable_swap && !cg->memory.filename_msw_usage_in_bytes)) {
@@ -2213,10 +2215,10 @@ static inline void discovery_update_filenames() {
2215 cg->memory.enabled_msw_usage_in_bytes = cgroup_enable_swap;
2216 snprintfz(filename, FILENAME_MAX, "%s%s/memory.memsw.limit_in_bytes", cgroup_memory_base, cg->id);
2217 cg->filename_memoryswap_limit = strdupz(filename);
2216 - debug(D_CGROUP, "memory.msw_usage_in_bytes filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_msw_usage_in_bytes);
2218 + netdata_log_debug(D_CGROUP, "memory.msw_usage_in_bytes filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_msw_usage_in_bytes);
2219 }
2220 else
2219 - debug(D_CGROUP, "memory.msw_usage_in_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2221 + netdata_log_debug(D_CGROUP, "memory.msw_usage_in_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2222 }
2223
2224 if(unlikely(cgroup_enable_memory_failcnt && !cg->memory.filename_failcnt)) {
@@ -2224,10 +2226,10 @@ static inline void discovery_update_filenames() {
2226 if(likely(stat(filename, &buf) != -1)) {
2227 cg->memory.filename_failcnt = strdupz(filename);
2228 cg->memory.enabled_failcnt = cgroup_enable_memory_failcnt;
2227 - debug(D_CGROUP, "memory.failcnt filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_failcnt);
2229 + netdata_log_debug(D_CGROUP, "memory.failcnt filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_failcnt);
2230 }
2231 else
2230 - debug(D_CGROUP, "memory.failcnt file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2232 + netdata_log_debug(D_CGROUP, "memory.failcnt file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2233 }
2234
2235 if(unlikely(cgroup_enable_blkio_io && !cg->io_service_bytes.filename)) {
@@ -2235,16 +2237,16 @@ static inline void discovery_update_filenames() {
2237 if (unlikely(stat(filename, &buf) != -1)) {
2238 cg->io_service_bytes.filename = strdupz(filename);
2239 cg->io_service_bytes.enabled = cgroup_enable_blkio_io;
2238 - debug(D_CGROUP, "blkio.io_service_bytes_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
2240 + netdata_log_debug(D_CGROUP, "blkio.io_service_bytes_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
2241 } else {
2240 - debug(D_CGROUP, "blkio.io_service_bytes_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2242 + netdata_log_debug(D_CGROUP, "blkio.io_service_bytes_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2243 snprintfz(filename, FILENAME_MAX, "%s%s/blkio.io_service_bytes", cgroup_blkio_base, cg->id);
2244 if (likely(stat(filename, &buf) != -1)) {
2245 cg->io_service_bytes.filename = strdupz(filename);
2246 cg->io_service_bytes.enabled = cgroup_enable_blkio_io;
2245 - debug(D_CGROUP, "blkio.io_service_bytes filename for cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
2247 + netdata_log_debug(D_CGROUP, "blkio.io_service_bytes filename for cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
2248 } else {
2247 - debug(D_CGROUP, "blkio.io_service_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2249 + netdata_log_debug(D_CGROUP, "blkio.io_service_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2250 }
2251 }
2252 }
@@ -2254,16 +2256,16 @@ static inline void discovery_update_filenames() {
2256 if (unlikely(stat(filename, &buf) != -1)) {
2257 cg->io_serviced.filename = strdupz(filename);
2258 cg->io_serviced.enabled = cgroup_enable_blkio_ops;
2257 - debug(D_CGROUP, "blkio.io_serviced_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_serviced.filename);
2259 + netdata_log_debug(D_CGROUP, "blkio.io_serviced_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_serviced.filename);
2260 } else {
2259 - debug(D_CGROUP, "blkio.io_serviced_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2261 + netdata_log_debug(D_CGROUP, "blkio.io_serviced_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2262 snprintfz(filename, FILENAME_MAX, "%s%s/blkio.io_serviced", cgroup_blkio_base, cg->id);
2263 if (likely(stat(filename, &buf) != -1)) {
2264 cg->io_serviced.filename = strdupz(filename);
2265 cg->io_serviced.enabled = cgroup_enable_blkio_ops;
2264 - debug(D_CGROUP, "blkio.io_serviced filename for cgroup '%s': '%s'", cg->id, cg->io_serviced.filename);
2266 + netdata_log_debug(D_CGROUP, "blkio.io_serviced filename for cgroup '%s': '%s'", cg->id, cg->io_serviced.filename);
2267 } else {
2266 - debug(D_CGROUP, "blkio.io_serviced file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2268 + netdata_log_debug(D_CGROUP, "blkio.io_serviced file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2269 }
2270 }
2271 }
@@ -2273,17 +2275,17 @@ static inline void discovery_update_filenames() {
2275 if (unlikely(stat(filename, &buf) != -1)) {
2276 cg->throttle_io_service_bytes.filename = strdupz(filename);
2277 cg->throttle_io_service_bytes.enabled = cgroup_enable_blkio_throttle_io;
2276 - debug(D_CGROUP,"blkio.throttle.io_service_bytes_recursive filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_service_bytes.filename);
2278 + netdata_log_debug(D_CGROUP,"blkio.throttle.io_service_bytes_recursive filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_service_bytes.filename);
2279 } else {
2278 - debug(D_CGROUP, "blkio.throttle.io_service_bytes_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2280 + netdata_log_debug(D_CGROUP, "blkio.throttle.io_service_bytes_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2281 snprintfz(
2282 filename, FILENAME_MAX, "%s%s/blkio.throttle.io_service_bytes", cgroup_blkio_base, cg->id);
2283 if (likely(stat(filename, &buf) != -1)) {
2284 cg->throttle_io_service_bytes.filename = strdupz(filename);
2285 cg->throttle_io_service_bytes.enabled = cgroup_enable_blkio_throttle_io;
2284 - debug(D_CGROUP, "blkio.throttle.io_service_bytes filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_service_bytes.filename);
2286 + netdata_log_debug(D_CGROUP, "blkio.throttle.io_service_bytes filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_service_bytes.filename);
2287 } else {
2286 - debug(D_CGROUP, "blkio.throttle.io_service_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2288 + netdata_log_debug(D_CGROUP, "blkio.throttle.io_service_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2289 }
2290 }
2291 }
@@ -2293,16 +2295,16 @@ static inline void discovery_update_filenames() {
2295 if (unlikely(stat(filename, &buf) != -1)) {
2296 cg->throttle_io_serviced.filename = strdupz(filename);
2297 cg->throttle_io_serviced.enabled = cgroup_enable_blkio_throttle_ops;
2296 - debug(D_CGROUP, "blkio.throttle.io_serviced_recursive filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_serviced.filename);
2298 + netdata_log_debug(D_CGROUP, "blkio.throttle.io_serviced_recursive filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_serviced.filename);
2299 } else {
2298 - debug(D_CGROUP, "blkio.throttle.io_serviced_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2300 + netdata_log_debug(D_CGROUP, "blkio.throttle.io_serviced_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2301 snprintfz(filename, FILENAME_MAX, "%s%s/blkio.throttle.io_serviced", cgroup_blkio_base, cg->id);
2302 if (likely(stat(filename, &buf) != -1)) {
2303 cg->throttle_io_serviced.filename = strdupz(filename);
2304 cg->throttle_io_serviced.enabled = cgroup_enable_blkio_throttle_ops;
2303 - debug(D_CGROUP, "blkio.throttle.io_serviced filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_serviced.filename);
2305 + netdata_log_debug(D_CGROUP, "blkio.throttle.io_serviced filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_serviced.filename);
2306 } else {
2305 - debug(D_CGROUP, "blkio.throttle.io_serviced file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2307 + netdata_log_debug(D_CGROUP, "blkio.throttle.io_serviced file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2308 }
2309 }
2310 }
@@ -2312,16 +2314,16 @@ static inline void discovery_update_filenames() {
2314 if (unlikely(stat(filename, &buf) != -1)) {
2315 cg->io_merged.filename = strdupz(filename);
2316 cg->io_merged.enabled = cgroup_enable_blkio_merged_ops;
2315 - debug(D_CGROUP, "blkio.io_merged_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_merged.filename);
2317 + netdata_log_debug(D_CGROUP, "blkio.io_merged_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_merged.filename);
2318 } else {
2317 - debug(D_CGROUP, "blkio.io_merged_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2319 + netdata_log_debug(D_CGROUP, "blkio.io_merged_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2320 snprintfz(filename, FILENAME_MAX, "%s%s/blkio.io_merged", cgroup_blkio_base, cg->id);
2321 if (likely(stat(filename, &buf) != -1)) {
2322 cg->io_merged.filename = strdupz(filename);
2323 cg->io_merged.enabled = cgroup_enable_blkio_merged_ops;
2322 - debug(D_CGROUP, "blkio.io_merged filename for cgroup '%s': '%s'", cg->id, cg->io_merged.filename);
2324 + netdata_log_debug(D_CGROUP, "blkio.io_merged filename for cgroup '%s': '%s'", cg->id, cg->io_merged.filename);
2325 } else {
2324 - debug(D_CGROUP, "blkio.io_merged file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2326 + netdata_log_debug(D_CGROUP, "blkio.io_merged file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2327 }
2328 }
2329 }
@@ -2331,16 +2333,16 @@ static inline void discovery_update_filenames() {
2333 if (unlikely(stat(filename, &buf) != -1)) {
2334 cg->io_queued.filename = strdupz(filename);
2335 cg->io_queued.enabled = cgroup_enable_blkio_queued_ops;
2334 - debug(D_CGROUP, "blkio.io_queued_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_queued.filename);
2336 + netdata_log_debug(D_CGROUP, "blkio.io_queued_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_queued.filename);
2337 } else {
2336 - debug(D_CGROUP, "blkio.io_queued_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2338 + netdata_log_debug(D_CGROUP, "blkio.io_queued_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2339 snprintfz(filename, FILENAME_MAX, "%s%s/blkio.io_queued", cgroup_blkio_base, cg->id);
2340 if (likely(stat(filename, &buf) != -1)) {
2341 cg->io_queued.filename = strdupz(filename);
2342 cg->io_queued.enabled = cgroup_enable_blkio_queued_ops;
2341 - debug(D_CGROUP, "blkio.io_queued filename for cgroup '%s': '%s'", cg->id, cg->io_queued.filename);
2343 + netdata_log_debug(D_CGROUP, "blkio.io_queued filename for cgroup '%s': '%s'", cg->id, cg->io_queued.filename);
2344 } else {
2343 - debug(D_CGROUP, "blkio.io_queued file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2345 + netdata_log_debug(D_CGROUP, "blkio.io_queued file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2346 }
2347 }
2348 }
@@ -2351,18 +2353,18 @@ static inline void discovery_update_filenames() {
2353 if(likely(stat(filename, &buf) != -1)) {
2354 cg->io_service_bytes.filename = strdupz(filename);
2355 cg->io_service_bytes.enabled = cgroup_enable_blkio_io;
2354 - debug(D_CGROUP, "io.stat filename for unified cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
2356 + netdata_log_debug(D_CGROUP, "io.stat filename for unified cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
2357 } else
2356 - debug(D_CGROUP, "io.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
2358 + netdata_log_debug(D_CGROUP, "io.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
2359 }
2360 if (unlikely(cgroup_enable_blkio_ops && !cg->io_serviced.filename)) {
2361 snprintfz(filename, FILENAME_MAX, "%s%s/io.stat", cgroup_unified_base, cg->id);
2362 if (likely(stat(filename, &buf) != -1)) {
2363 cg->io_serviced.filename = strdupz(filename);
2364 cg->io_serviced.enabled = cgroup_enable_blkio_ops;
2363 - debug(D_CGROUP, "io.stat filename for unified cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
2365 + netdata_log_debug(D_CGROUP, "io.stat filename for unified cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
2366 } else
2365 - debug(D_CGROUP, "io.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
2367 + netdata_log_debug(D_CGROUP, "io.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
2368 }
2369 if (unlikely(
2370 (cgroup_enable_cpuacct_stat || cgroup_enable_cpuacct_cpu_throttling) &&
@@ -2376,19 +2378,19 @@ static inline void discovery_update_filenames() {
2378 cg->filename_cpu_cfs_period = NULL;
2379 snprintfz(filename, FILENAME_MAX, "%s%s/cpu.max", cgroup_unified_base, cg->id);
2380 cg->filename_cpu_cfs_quota = strdupz(filename);
2379 - debug(D_CGROUP, "cpu.stat filename for unified cgroup '%s': '%s'", cg->id, cg->cpuacct_stat.filename);
2381 + netdata_log_debug(D_CGROUP, "cpu.stat filename for unified cgroup '%s': '%s'", cg->id, cg->cpuacct_stat.filename);
2382 }
2383 else
2382 - debug(D_CGROUP, "cpu.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
2384 + netdata_log_debug(D_CGROUP, "cpu.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
2385 }
2386 if (unlikely(cgroup_enable_cpuacct_cpu_shares && !cg->cpuacct_cpu_shares.filename)) {
2387 snprintfz(filename, FILENAME_MAX, "%s%s/cpu.weight", cgroup_unified_base, cg->id);
2388 if (likely(stat(filename, &buf) != -1)) {
2389 cg->cpuacct_cpu_shares.filename = strdupz(filename);
2390 cg->cpuacct_cpu_shares.enabled = cgroup_enable_cpuacct_cpu_shares;
2389 - debug(D_CGROUP, "cpu.weight filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_shares.filename);
2391 + netdata_log_debug(D_CGROUP, "cpu.weight filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_shares.filename);
2392 } else
2391 - debug(D_CGROUP, "cpu.weight file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2393 + netdata_log_debug(D_CGROUP, "cpu.weight file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2394 }
2395
2396 if(unlikely((cgroup_enable_detailed_memory || cgroup_used_memory) && !cg->memory.filename_detailed && (cgroup_used_memory || cgroup_enable_systemd_services_detailed_memory || !is_cgroup_systemd_service(cg)))) {
@@ -2396,10 +2398,10 @@ static inline void discovery_update_filenames() {
2398 if(likely(stat(filename, &buf) != -1)) {
2399 cg->memory.filename_detailed = strdupz(filename);
2400 cg->memory.enabled_detailed = (cgroup_enable_detailed_memory == CONFIG_BOOLEAN_YES)?CONFIG_BOOLEAN_YES:CONFIG_BOOLEAN_AUTO;
2399 - debug(D_CGROUP, "memory.stat filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_detailed);
2401 + netdata_log_debug(D_CGROUP, "memory.stat filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_detailed);
2402 }
2403 else
2402 - debug(D_CGROUP, "memory.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2404 + netdata_log_debug(D_CGROUP, "memory.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2405 }
2406
2407 if(unlikely(cgroup_enable_memory && !cg->memory.filename_usage_in_bytes)) {
@@ -2407,12 +2409,12 @@ static inline void discovery_update_filenames() {
2409 if(likely(stat(filename, &buf) != -1)) {
2410 cg->memory.filename_usage_in_bytes = strdupz(filename);
2411 cg->memory.enabled_usage_in_bytes = cgroup_enable_memory;
2410 - debug(D_CGROUP, "memory.current filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_usage_in_bytes);
2412 + netdata_log_debug(D_CGROUP, "memory.current filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_usage_in_bytes);
2413 snprintfz(filename, FILENAME_MAX, "%s%s/memory.max", cgroup_unified_base, cg->id);
2414 cg->filename_memory_limit = strdupz(filename);
2415 }
2416 else
2415 - debug(D_CGROUP, "memory.current file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2417 + netdata_log_debug(D_CGROUP, "memory.current file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2418 }
2419
2420 if(unlikely(cgroup_enable_swap && !cg->memory.filename_msw_usage_in_bytes)) {
@@ -2422,10 +2424,10 @@ static inline void discovery_update_filenames() {
2424 cg->memory.enabled_msw_usage_in_bytes = cgroup_enable_swap;
2425 snprintfz(filename, FILENAME_MAX, "%s%s/memory.swap.max", cgroup_unified_base, cg->id);
2426 cg->filename_memoryswap_limit = strdupz(filename);
2425 - debug(D_CGROUP, "memory.swap.current filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_msw_usage_in_bytes);
2427 + netdata_log_debug(D_CGROUP, "memory.swap.current filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_msw_usage_in_bytes);
2428 }
2429 else
2428 - debug(D_CGROUP, "memory.swap file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2430 + netdata_log_debug(D_CGROUP, "memory.swap file for cgroup '%s': '%s' does not exist.", cg->id, filename);
2431 }
2432
2433 if (unlikely(cgroup_enable_pressure_cpu && !cg->cpu_pressure.filename)) {
@@ -2434,9 +2436,9 @@ static inline void discovery_update_filenames() {
2436 cg->cpu_pressure.filename = strdupz(filename);
2437 cg->cpu_pressure.some.enabled = cgroup_enable_pressure_cpu;
2438 cg->cpu_pressure.full.enabled = CONFIG_BOOLEAN_NO;
2437 - debug(D_CGROUP, "cpu.pressure filename for cgroup '%s': '%s'", cg->id, cg->cpu_pressure.filename);
2439 + netdata_log_debug(D_CGROUP, "cpu.pressure filename for cgroup '%s': '%s'", cg->id, cg->cpu_pressure.filename);
2440 } else {
2439 - debug(D_CGROUP, "cpu.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
2441 + netdata_log_debug(D_CGROUP, "cpu.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
2442 }
2443 }
2444
@@ -2446,9 +2448,9 @@ static inline void discovery_update_filenames() {
2448 cg->io_pressure.filename = strdupz(filename);
2449 cg->io_pressure.some.enabled = cgroup_enable_pressure_io_some;
2450 cg->io_pressure.full.enabled = cgroup_enable_pressure_io_full;
2449 - debug(D_CGROUP, "io.pressure filename for cgroup '%s': '%s'", cg->id, cg->io_pressure.filename);
2451 + netdata_log_debug(D_CGROUP, "io.pressure filename for cgroup '%s': '%s'", cg->id, cg->io_pressure.filename);
2452 } else {
2451 - debug(D_CGROUP, "io.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
2453 + netdata_log_debug(D_CGROUP, "io.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
2454 }
2455 }
2456
@@ -2458,9 +2460,9 @@ static inline void discovery_update_filenames() {
2460 cg->memory_pressure.filename = strdupz(filename);
2461 cg->memory_pressure.some.enabled = cgroup_enable_pressure_memory_some;
2462 cg->memory_pressure.full.enabled = cgroup_enable_pressure_memory_full;
2461 - debug(D_CGROUP, "memory.pressure filename for cgroup '%s': '%s'", cg->id, cg->memory_pressure.filename);
2463 + netdata_log_debug(D_CGROUP, "memory.pressure filename for cgroup '%s': '%s'", cg->id, cg->memory_pressure.filename);
2464 } else {
2463 - debug(D_CGROUP, "memory.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
2465 + netdata_log_debug(D_CGROUP, "memory.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
2466 }
2467 }
2468 }
@@ -2477,7 +2479,7 @@ static inline void discovery_cleanup_all_cgroups() {
2479 struct cgroup *t;
2480 for(t = discovered_cgroup_root; t ; t = t->discovered_next) {
2481 if(t != cg && t->available && !t->enabled && t->options & CGROUP_OPTIONS_DISABLED_DUPLICATE && t->hash_chart == cg->hash_chart && !strcmp(t->chart_id, cg->chart_id)) {
2480 - debug(D_CGROUP, "Enabling duplicate of cgroup '%s' with id '%s', because the original with id '%s' stopped.", t->chart_id, t->id, cg->id);
2482 + netdata_log_debug(D_CGROUP, "Enabling duplicate of cgroup '%s' with id '%s', because the original with id '%s' stopped.", t->chart_id, t->id, cg->id);
2483 t->enabled = 1;
2484 t->options &= ~CGROUP_OPTIONS_DISABLED_DUPLICATE;
2485 break;
@@ -2505,7 +2507,7 @@ static inline void discovery_cleanup_all_cgroups() {
2507 }
2508
2509 static inline void discovery_copy_discovered_cgroups_to_reader() {
2508 - debug(D_CGROUP, "copy discovered cgroups to the main group list");
2510 + netdata_log_debug(D_CGROUP, "copy discovered cgroups to the main group list");
2511
2512 struct cgroup *cg;
2513
@@ -2543,7 +2545,7 @@ static inline void discovery_share_cgroups_with_ebpf() {
2545 is_cgroup_procs_exist(ptr, cg->id);
2546 }
2547
2546 - debug(D_CGROUP, "cgroup shared: NAME=%s, ENABLED=%d", ptr->name, ptr->enabled);
2548 + netdata_log_debug(D_CGROUP, "cgroup shared: NAME=%s, ENABLED=%d", ptr->name, ptr->enabled);
2549 }
2550
2551 shm_cgroup_ebpf.header->cgroup_root_count = count;
@@ -2633,13 +2635,13 @@ static inline void discovery_process_first_time_seen_cgroup(struct cgroup *cg) {
2635 }
2636
2637 if (cgroup_enable_systemd_services && matches_systemd_services_cgroups(cg->id)) {
2636 - debug(D_CGROUP, "cgroup '%s' (name '%s') matches 'cgroups to match as systemd services'", cg->id, cg->chart_title);
2638 + netdata_log_debug(D_CGROUP, "cgroup '%s' (name '%s') matches 'cgroups to match as systemd services'", cg->id, cg->chart_title);
2639 convert_cgroup_to_systemd_service(cg);
2640 return;
2641 }
2642
2643 if (matches_enabled_cgroup_renames(cg->id)) {
2642 - debug(D_CGROUP, "cgroup '%s' (name '%s') matches 'run script to rename cgroups matching', will try to rename it", cg->id, cg->chart_title);
2644 + netdata_log_debug(D_CGROUP, "cgroup '%s' (name '%s') matches 'run script to rename cgroups matching', will try to rename it", cg->id, cg->chart_title);
2645 if (is_inside_k8s && k8s_is_container(cg->id)) {
2646 // it may take up to a minute for the K8s API to return data for the container
2647 // tested on AWS K8s cluster with 100% CPU utilization
@@ -2664,7 +2666,7 @@ static int discovery_is_cgroup_duplicate(struct cgroup *cg) {
2666
2667 static inline void discovery_process_cgroup(struct cgroup *cg) {
2668 if (!cg) {
2667 - debug(D_CGROUP, "discovery_process_cgroup() received NULL");
2669 + netdata_log_debug(D_CGROUP, "discovery_process_cgroup() received NULL");
2670 return;
2671 }
2672 if (!cg->available || cg->processed) {
@@ -2700,12 +2702,12 @@ static inline void discovery_process_cgroup(struct cgroup *cg) {
2702 }
2703
2704 if (!(cg->enabled = matches_enabled_cgroup_names(cg->chart_title))) {
2703 - debug(D_CGROUP, "cgroup '%s' (name '%s') disabled by 'enable by default cgroups names matching'", cg->id, cg->chart_title);
2705 + netdata_log_debug(D_CGROUP, "cgroup '%s' (name '%s') disabled by 'enable by default cgroups names matching'", cg->id, cg->chart_title);
2706 return;
2707 }
2708
2709 if (!(cg->enabled = matches_enabled_cgroup_paths(cg->id))) {
2708 - debug(D_CGROUP, "cgroup '%s' (name '%s') disabled by 'enable by default cgroups matching'", cg->id, cg->chart_title);
2710 + netdata_log_debug(D_CGROUP, "cgroup '%s' (name '%s') disabled by 'enable by default cgroups matching'", cg->id, cg->chart_title);
2711 return;
2712 }
2713
@@ -2730,7 +2732,7 @@ static inline void discovery_process_cgroup(struct cgroup *cg) {
2732 }
2733
2734 static inline void discovery_find_all_cgroups() {
2733 - debug(D_CGROUP, "searching for cgroups");
2735 + netdata_log_debug(D_CGROUP, "searching for cgroups");
2736
2737 worker_is_busy(WORKER_DISCOVERY_INIT);
2738 discovery_mark_all_cgroups_as_unavailable();
@@ -2765,7 +2767,7 @@ static inline void discovery_find_all_cgroups() {
2767 worker_is_busy(WORKER_DISCOVERY_SHARE);
2768 discovery_share_cgroups_with_ebpf();
2769
2768 - debug(D_CGROUP, "done searching for cgroups");
2770 + netdata_log_debug(D_CGROUP, "done searching for cgroups");
2771 }
2772
2773 static void cgroup_discovery_cleanup(void *ptr) {
@@ -3587,7 +3589,7 @@ static inline void update_cpu_limits2(struct cgroup *cg) {
3589 } else {
3590 cg->cpu_cfs_quota = str2ull(procfile_lineword(ff, 0, 0), NULL);
3591 }
3590 - debug(D_CGROUP, "CPU limits values: %llu %llu %llu", cg->cpu_cfs_period, cg->cpuset_cpus, cg->cpu_cfs_quota);
3592 + netdata_log_debug(D_CGROUP, "CPU limits values: %llu %llu %llu", cg->cpu_cfs_period, cg->cpuset_cpus, cg->cpu_cfs_quota);
3593 return;
3594
3595 cpu_limits2_err:
@@ -3645,7 +3647,7 @@ static inline int update_memory_limits(char **filename, const RRDSETVAR_ACQUIRED
3647 }
3648
3649 void update_cgroup_charts(int update_every) {
3648 - debug(D_CGROUP, "updating cgroups charts");
3650 + netdata_log_debug(D_CGROUP, "updating cgroups charts");
3651
3652 char type[RRD_ID_LENGTH_MAX + 1];
3653 char title[CHART_TITLE_MAX + 1];
@@ -4754,7 +4756,7 @@ void update_cgroup_charts(int update_every) {
4756 , services_do_queued_ops, services_do_merged_ops
4757 );
4758
4757 - debug(D_CGROUP, "done updating cgroups charts");
4759 + netdata_log_debug(D_CGROUP, "done updating cgroups charts");
4760 }
4761
4762 // ----------------------------------------------------------------------------
collectors/ebpf.plugin/ebpf.c
+1 -2
@@ -1541,8 +1541,7 @@ uint32_t ebpf_enable_tracepoints(ebpf_tracepoint_t *tps)
1541 uint32_t cnt = 0;
1542 for (int i = 0; tps[i].class != NULL; i++) {
1543 if (ebpf_enable_tracepoint(&tps[i]) == -1) {
1544 - infoerr("failed to enable tracepoint %s:%s",
1545 - tps[i].class, tps[i].event);
1544 + netdata_log_error("Failed to enable tracepoint %s:%s", tps[i].class, tps[i].event);
1545 }
1546 else {
1547 cnt += 1;
collectors/freebsd.plugin/plugin_freebsd.c
+1 -1
@@ -121,7 +121,7 @@ void *freebsd_main(void *ptr)
121 if (unlikely(!pm->enabled))
122 continue;
123
124 - debug(D_PROCNETDEV_LOOP, "FREEBSD calling %s.", pm->name);
124 + netdata_log_debug(D_PROCNETDEV_LOOP, "FREEBSD calling %s.", pm->name);
125
126 worker_is_busy(i);
127 pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
collectors/macos.plugin/plugin_macos.c
+1 -1
@@ -66,7 +66,7 @@ void *macos_main(void *ptr)
66 if (unlikely(!pm->enabled))
67 continue;
68
69 - debug(D_PROCNETDEV_LOOP, "macos calling %s.", pm->name);
69 + netdata_log_debug(D_PROCNETDEV_LOOP, "macos calling %s.", pm->name);
70
71 worker_is_busy(i);
72 pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
collectors/plugins.d/plugins_d.c
+4 -4
@@ -245,7 +245,7 @@ void *pluginsd_main(void *ptr)
245 if (unlikely(!service_running(SERVICE_COLLECTORS)))
246 break;
247
248 - debug(D_PLUGINSD, "examining file '%s'", file->d_name);
248 + netdata_log_debug(D_PLUGINSD, "examining file '%s'", file->d_name);
249
250 if (unlikely(strcmp(file->d_name, ".") == 0 || strcmp(file->d_name, "..") == 0))
251 continue;
@@ -254,7 +254,7 @@ void *pluginsd_main(void *ptr)
254 if (unlikely(len <= (int)PLUGINSD_FILE_SUFFIX_LEN))
255 continue;
256 if (unlikely(strcmp(PLUGINSD_FILE_SUFFIX, &file->d_name[len - (int)PLUGINSD_FILE_SUFFIX_LEN]) != 0)) {
257 - debug(D_PLUGINSD, "file '%s' does not end in '%s'", file->d_name, PLUGINSD_FILE_SUFFIX);
257 + netdata_log_debug(D_PLUGINSD, "file '%s' does not end in '%s'", file->d_name, PLUGINSD_FILE_SUFFIX);
258 continue;
259 }
260
@@ -263,7 +263,7 @@ void *pluginsd_main(void *ptr)
263 int enabled = config_get_boolean(CONFIG_SECTION_PLUGINS, pluginname, automatic_run);
264
265 if (unlikely(!enabled)) {
266 - debug(D_PLUGINSD, "plugin '%s' is not enabled", file->d_name);
266 + netdata_log_debug(D_PLUGINSD, "plugin '%s' is not enabled", file->d_name);
267 continue;
268 }
269
@@ -274,7 +274,7 @@ void *pluginsd_main(void *ptr)
274 break;
275
276 if (likely(cd && plugin_is_running(cd))) {
277 - debug(D_PLUGINSD, "plugin '%s' is already running", cd->filename);
277 + netdata_log_debug(D_PLUGINSD, "plugin '%s' is already running", cd->filename);
278 continue;
279 }
280
collectors/plugins.d/pluginsd_parser.c
+7 -7
@@ -237,7 +237,7 @@ static inline PARSER_RC pluginsd_set(char **words, size_t num_words, PARSER *par
237 if(!rd) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
238
239 if (unlikely(rrdset_flag_check(st, RRDSET_FLAG_DEBUG)))
240 - debug(D_PLUGINSD, "PLUGINSD: 'host:%s/chart:%s/dim:%s' SET is setting value to '%s'",
240 + netdata_log_debug(D_PLUGINSD, "PLUGINSD: 'host:%s/chart:%s/dim:%s' SET is setting value to '%s'",
241 rrdhost_hostname(host), rrdset_id(st), dimension, value && *value ? value : "UNSET");
242
243 if (value && *value)
@@ -303,7 +303,7 @@ static inline PARSER_RC pluginsd_end(char **words, size_t num_words, PARSER *par
303 if(!st) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
304
305 if (unlikely(rrdset_flag_check(st, RRDSET_FLAG_DEBUG)))
306 - debug(D_PLUGINSD, "requested an END on chart '%s'", rrdset_id(st));
306 + netdata_log_debug(D_PLUGINSD, "requested an END on chart '%s'", rrdset_id(st));
307
308 pluginsd_set_chart_from_parent(parser, NULL, PLUGINSD_KEYWORD_END);
309 parser->user.data_collections_count++;
@@ -517,7 +517,7 @@ static inline PARSER_RC pluginsd_chart(char **words, size_t num_words, PARSER *p
517 if (unlikely(!units))
518 units = "unknown";
519
520 - debug(
520 + netdata_log_debug(
521 D_PLUGINSD,
522 "creating chart type='%s', id='%s', name='%s', family='%s', context='%s', chart='%s', priority=%d, update_every=%d",
523 type, id, name ? name : "", family ? family : "", context ? context : "", rrdset_type_name(chart_type),
@@ -642,7 +642,7 @@ static inline PARSER_RC pluginsd_dimension(char **words, size_t num_words, PARSE
642 algorithm = "absolute";
643
644 if (unlikely(st && rrdset_flag_check(st, RRDSET_FLAG_DEBUG)))
645 - debug(
645 + netdata_log_debug(
646 D_PLUGINSD,
647 "creating dimension in chart %s, id='%s', name='%s', algorithm='%s', multiplier=%ld, divisor=%ld, hidden='%s'",
648 rrdset_id(st), id, name ? name : "", rrd_algorithm_name(rrd_algorithm_id(algorithm)), multiplier, divisor,
@@ -1013,7 +1013,7 @@ static inline PARSER_RC pluginsd_variable(char **words, size_t num_words, PARSER
1013 }
1014
1015 static inline PARSER_RC pluginsd_flush(char **words __maybe_unused, size_t num_words __maybe_unused, PARSER *parser) {
1016 - debug(D_PLUGINSD, "requested a " PLUGINSD_KEYWORD_FLUSH);
1016 + netdata_log_debug(D_PLUGINSD, "requested a " PLUGINSD_KEYWORD_FLUSH);
1017 pluginsd_set_chart_from_parent(parser, NULL, PLUGINSD_KEYWORD_FLUSH);
1018 parser->user.replay.start_time = 0;
1019 parser->user.replay.end_time = 0;
@@ -1078,7 +1078,7 @@ static inline PARSER_RC pluginsd_overwrite(char **words __maybe_unused, size_t n
1078 RRDHOST *host = pluginsd_require_host_from_parent(parser, PLUGINSD_KEYWORD_OVERWRITE);
1079 if(!host) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
1080
1081 - debug(D_PLUGINSD, "requested to OVERWRITE host labels");
1081 + netdata_log_debug(D_PLUGINSD, "requested to OVERWRITE host labels");
1082
1083 if(unlikely(!host->rrdlabels))
1084 host->rrdlabels = rrdlabels_create();
@@ -1119,7 +1119,7 @@ static inline PARSER_RC pluginsd_clabel_commit(char **words __maybe_unused, size
1119 RRDSET *st = pluginsd_require_chart_from_parent(parser, PLUGINSD_KEYWORD_CLABEL_COMMIT, PLUGINSD_KEYWORD_BEGIN);
1120 if(!st) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
1121
1122 - debug(D_PLUGINSD, "requested to commit chart labels");
1122 + netdata_log_debug(D_PLUGINSD, "requested to commit chart labels");
1123
1124 if(!parser->user.chart_rrdlabels_linked_temporarily) {
1125 netdata_log_error("PLUGINSD: 'host:%s' got CLABEL_COMMIT, without a CHART or BEGIN. Ignoring it.", rrdhost_hostname(host));
collectors/proc.plugin/plugin_proc.c
+2 -2
@@ -139,7 +139,7 @@ void *proc_main(void *ptr)
139
140 if (config_get_boolean("plugin:proc", "/proc/net/dev", CONFIG_BOOLEAN_YES)) {
141 netdev_thread = mallocz(sizeof(netdata_thread_t));
142 - debug(D_SYSTEM, "Starting thread %s.", THREAD_NETDEV_NAME);
142 + netdata_log_debug(D_SYSTEM, "Starting thread %s.", THREAD_NETDEV_NAME);
143 netdata_thread_create(
144 netdev_thread, THREAD_NETDEV_NAME, NETDATA_THREAD_OPTION_JOINABLE, netdev_main, netdev_thread);
145 }
@@ -180,7 +180,7 @@ void *proc_main(void *ptr)
180 if (unlikely(!pm->enabled))
181 continue;
182
183 - debug(D_PROCNETDEV_LOOP, "PROC calling %s.", pm->name);
183 + netdata_log_debug(D_PROCNETDEV_LOOP, "PROC calling %s.", pm->name);
184
185 worker_is_busy(i);
186 pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
collectors/statsd.plugin/statsd.c
+32 -32
@@ -370,7 +370,7 @@ static void dictionary_metric_insert_callback(const DICTIONARY_ITEM *item, void
370 STATSD_METRIC *m = (STATSD_METRIC *)value;
371 const char *name = dictionary_acquired_item_name(item);
372
373 - debug(D_STATSD, "Creating new %s metric '%s'", index->name, name);
373 + netdata_log_debug(D_STATSD, "Creating new %s metric '%s'", index->name, name);
374
375 m->name = name;
376 m->hash = simple_hash(name);
@@ -401,7 +401,7 @@ static void dictionary_metric_delete_callback(const DICTIONARY_ITEM *item, void
401 }
402
403 static inline STATSD_METRIC *statsd_find_or_add_metric(STATSD_INDEX *index, const char *name) {
404 - debug(D_STATSD, "searching for metric '%s' under '%s'", name, index->name);
404 + netdata_log_debug(D_STATSD, "searching for metric '%s' under '%s'", name, index->name);
405
406 #ifdef STATSD_MULTITHREADED
407 // avoid the write lock of dictionary_set() for existing metrics
@@ -673,7 +673,7 @@ static inline const char *statsd_parse_field_trim(const char *start, char *end)
673 }
674
675 static void statsd_process_metric(const char *name, const char *value, const char *type, const char *sampling, const char *tags) {
676 - debug(D_STATSD, "STATSD: raw metric '%s', value '%s', type '%s', sampling '%s', tags '%s'", name?name:"(null)", value?value:"(null)", type?type:"(null)", sampling?sampling:"(null)", tags?tags:"(null)");
676 + netdata_log_debug(D_STATSD, "STATSD: raw metric '%s', value '%s', type '%s', sampling '%s', tags '%s'", name?name:"(null)", value?value:"(null)", type?type:"(null)", sampling?sampling:"(null)", tags?tags:"(null)");
677
678 if(unlikely(!name || !*name)) return;
679 if(unlikely(!type || !*type)) type = "m";
@@ -768,7 +768,7 @@ static void statsd_process_metric(const char *name, const char *value, const cha
768
769 static inline size_t statsd_process(char *buffer, size_t size, int require_newlines) {
770 buffer[size] = '\0';
771 - debug(D_STATSD, "RECEIVED: %zu bytes: '%s'", size, buffer);
771 + netdata_log_debug(D_STATSD, "RECEIVED: %zu bytes: '%s'", size, buffer);
772
773 const char *s = buffer;
774 while(*s) {
@@ -949,7 +949,7 @@ static int statsd_rcv_callback(POLLINFO *pi, short int *events) {
949 }
950 else if (!rc) {
951 // connection closed
952 - debug(D_STATSD, "STATSD: client disconnected.");
952 + netdata_log_debug(D_STATSD, "STATSD: client disconnected.");
953 ret = -1;
954 }
955 else {
@@ -1231,14 +1231,14 @@ static STATSD_APP_CHART_DIM *add_dimension_to_app_chart(
1231 }
1232 chart->dimensions_count++;
1233
1234 - debug(D_STATSD, "Added dimension '%s' to chart '%s' of app '%s', for metric '%s', with type %u, multiplier %d, divisor %d",
1234 + netdata_log_debug(D_STATSD, "Added dimension '%s' to chart '%s' of app '%s', for metric '%s', with type %u, multiplier %d, divisor %d",
1235 dim->name, chart->id, app->name, dim->metric, dim->value_type, dim->multiplier, dim->divisor);
1236
1237 return dim;
1238 }
1239
1240 static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHART *chart, DICTIONARY *dict) {
1241 - debug(D_STATSD, "STATSD configuration reading file '%s'", filename);
1241 + netdata_log_debug(D_STATSD, "STATSD configuration reading file '%s'", filename);
1242
1243 char *buffer = mallocz(STATSD_CONF_LINE_MAX + 1);
1244
@@ -1257,11 +1257,11 @@ static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHA
1257
1258 s = trim(buffer);
1259 if (!s || *s == '#') {
1260 - debug(D_STATSD, "STATSD: ignoring line %zu of file '%s', it is empty.", line, filename);
1260 + netdata_log_debug(D_STATSD, "STATSD: ignoring line %zu of file '%s', it is empty.", line, filename);
1261 continue;
1262 }
1263
1264 - debug(D_STATSD, "STATSD: processing line %zu of file '%s': %s", line, filename, buffer);
1264 + netdata_log_debug(D_STATSD, "STATSD: processing line %zu of file '%s': %s", line, filename, buffer);
1265
1266 if(*s == 'i' && strncmp(s, "include", 7) == 0) {
1267 s = trim(&s[7]);
@@ -1375,7 +1375,7 @@ static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHA
1375 continue;
1376 }
1377 if(!value) {
1378 - debug(D_CONFIG, "STATSD: ignoring line %zu of file '%s', value is empty.", line, filename);
1378 + netdata_log_debug(D_CONFIG, "STATSD: ignoring line %zu of file '%s', value is empty.", line, filename);
1379 continue;
1380 }
1381
@@ -1625,7 +1625,7 @@ static inline RRDSET *statsd_private_rrdset_create(
1625 }
1626
1627 static inline void statsd_private_chart_gauge(STATSD_METRIC *m) {
1628 - debug(D_STATSD, "updating private chart for gauge metric '%s'", m->name);
1628 + netdata_log_debug(D_STATSD, "updating private chart for gauge metric '%s'", m->name);
1629
1630 if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
1631 m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
@@ -1665,7 +1665,7 @@ static inline void statsd_private_chart_gauge(STATSD_METRIC *m) {
1665 }
1666
1667 static inline void statsd_private_chart_counter_or_meter(STATSD_METRIC *m, const char *dim, const char *family) {
1668 - debug(D_STATSD, "updating private chart for %s metric '%s'", dim, m->name);
1668 + netdata_log_debug(D_STATSD, "updating private chart for %s metric '%s'", dim, m->name);
1669
1670 if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
1671 m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
@@ -1705,7 +1705,7 @@ static inline void statsd_private_chart_counter_or_meter(STATSD_METRIC *m, const
1705 }
1706
1707 static inline void statsd_private_chart_set(STATSD_METRIC *m) {
1708 - debug(D_STATSD, "updating private chart for set metric '%s'", m->name);
1708 + netdata_log_debug(D_STATSD, "updating private chart for set metric '%s'", m->name);
1709
1710 if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
1711 m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
@@ -1745,7 +1745,7 @@ static inline void statsd_private_chart_set(STATSD_METRIC *m) {
1745 }
1746
1747 static inline void statsd_private_chart_dictionary(STATSD_METRIC *m) {
1748 - debug(D_STATSD, "updating private chart for dictionary metric '%s'", m->name);
1748 + netdata_log_debug(D_STATSD, "updating private chart for dictionary metric '%s'", m->name);
1749
1750 if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
1751 m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
@@ -1788,7 +1788,7 @@ static inline void statsd_private_chart_dictionary(STATSD_METRIC *m) {
1788 }
1789
1790 static inline void statsd_private_chart_timer_or_histogram(STATSD_METRIC *m, const char *dim, const char *family, const char *units) {
1791 - debug(D_STATSD, "updating private chart for %s metric '%s'", dim, m->name);
1791 + netdata_log_debug(D_STATSD, "updating private chart for %s metric '%s'", dim, m->name);
1792
1793 if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
1794 m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
@@ -1843,7 +1843,7 @@ static inline void statsd_private_chart_timer_or_histogram(STATSD_METRIC *m, con
1843 // statsd flush metrics
1844
1845 static inline void statsd_flush_gauge(STATSD_METRIC *m) {
1846 - debug(D_STATSD, "flushing gauge metric '%s'", m->name);
1846 + netdata_log_debug(D_STATSD, "flushing gauge metric '%s'", m->name);
1847
1848 int updated = 0;
1849 if(unlikely(!m->reset && m->count)) {
@@ -1858,7 +1858,7 @@ static inline void statsd_flush_gauge(STATSD_METRIC *m) {
1858 }
1859
1860 static inline void statsd_flush_counter_or_meter(STATSD_METRIC *m, const char *dim, const char *family) {
1861 - debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
1861 + netdata_log_debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
1862
1863 int updated = 0;
1864 if(unlikely(!m->reset && m->count)) {
@@ -1881,7 +1881,7 @@ static inline void statsd_flush_meter(STATSD_METRIC *m) {
1881 }
1882
1883 static inline void statsd_flush_set(STATSD_METRIC *m) {
1884 - debug(D_STATSD, "flushing set metric '%s'", m->name);
1884 + netdata_log_debug(D_STATSD, "flushing set metric '%s'", m->name);
1885
1886 int updated = 0;
1887 if(unlikely(!m->reset && m->count)) {
@@ -1899,7 +1899,7 @@ static inline void statsd_flush_set(STATSD_METRIC *m) {
1899 }
1900
1901 static inline void statsd_flush_dictionary(STATSD_METRIC *m) {
1902 - debug(D_STATSD, "flushing dictionary metric '%s'", m->name);
1902 + netdata_log_debug(D_STATSD, "flushing dictionary metric '%s'", m->name);
1903
1904 int updated = 0;
1905 if(unlikely(!m->reset && m->count)) {
@@ -1927,7 +1927,7 @@ static inline void statsd_flush_dictionary(STATSD_METRIC *m) {
1927 }
1928
1929 static inline void statsd_flush_timer_or_histogram(STATSD_METRIC *m, const char *dim, const char *family, const char *units) {
1930 - debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
1930 + netdata_log_debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
1931
1932 int updated = 0;
1933 if(unlikely(!m->reset && m->count && m->histogram.ext->used > 0)) {
@@ -1952,7 +1952,7 @@ static inline void statsd_flush_timer_or_histogram(STATSD_METRIC *m, const char
1952
1953 netdata_mutex_unlock(&m->histogram.ext->mutex);
1954
1955 - debug(D_STATSD, "STATSD %s metric %s: min " COLLECTED_NUMBER_FORMAT ", max " COLLECTED_NUMBER_FORMAT ", last " COLLECTED_NUMBER_FORMAT ", pcent " COLLECTED_NUMBER_FORMAT ", median " COLLECTED_NUMBER_FORMAT ", stddev " COLLECTED_NUMBER_FORMAT ", sum " COLLECTED_NUMBER_FORMAT,
1955 + netdata_log_debug(D_STATSD, "STATSD %s metric %s: min " COLLECTED_NUMBER_FORMAT ", max " COLLECTED_NUMBER_FORMAT ", last " COLLECTED_NUMBER_FORMAT ", pcent " COLLECTED_NUMBER_FORMAT ", median " COLLECTED_NUMBER_FORMAT ", stddev " COLLECTED_NUMBER_FORMAT ", sum " COLLECTED_NUMBER_FORMAT,
1956 dim, m->name, m->histogram.ext->last_min, m->histogram.ext->last_max, m->last, m->histogram.ext->last_percentile, m->histogram.ext->last_median, m->histogram.ext->last_stddev, m->histogram.ext->last_sum);
1957
1958 m->histogram.ext->zeroed = 0;
@@ -2066,7 +2066,7 @@ static inline void link_metric_to_app_dimension(STATSD_APP *app, STATSD_METRIC *
2066
2067 chart->dimensions_linked_count++;
2068 m->options |= STATSD_METRIC_OPTION_USED_IN_APPS;
2069 - debug(D_STATSD, "metric '%s' of type %u linked with app '%s', chart '%s', dimension '%s', algorithm '%s'", m->name, m->type, app->name, chart->id, dim->name, rrd_algorithm_name(dim->algorithm));
2069 + netdata_log_debug(D_STATSD, "metric '%s' of type %u linked with app '%s', chart '%s', dimension '%s', algorithm '%s'", m->name, m->type, app->name, chart->id, dim->name, rrd_algorithm_name(dim->algorithm));
2070 }
2071
2072 static inline void check_if_metric_is_for_app(STATSD_INDEX *index, STATSD_METRIC *m) {
@@ -2075,7 +2075,7 @@ static inline void check_if_metric_is_for_app(STATSD_INDEX *index, STATSD_METRIC
2075 STATSD_APP *app;
2076 for(app = statsd.apps; app ;app = app->next) {
2077 if(unlikely(simple_pattern_matches(app->metrics, m->name))) {
2078 - debug(D_STATSD, "metric '%s' matches app '%s'", m->name, app->name);
2078 + netdata_log_debug(D_STATSD, "metric '%s' matches app '%s'", m->name, app->name);
2079
2080 // the metric should get the options from the app
2081
@@ -2200,7 +2200,7 @@ static inline RRDDIM *statsd_add_dim_to_app_chart(STATSD_APP *app, STATSD_APP_CH
2200 }
2201
2202 static inline void statsd_update_app_chart(STATSD_APP *app, STATSD_APP_CHART *chart) {
2203 - debug(D_STATSD, "updating chart '%s' for app '%s'", chart->id, app->name);
2203 + netdata_log_debug(D_STATSD, "updating chart '%s' for app '%s'", chart->id, app->name);
2204
2205 if(!chart->st) {
2206 chart->st = rrdset_create_custom(
@@ -2232,22 +2232,22 @@ static inline void statsd_update_app_chart(STATSD_APP *app, STATSD_APP_CHART *ch
2232 statsd_add_dim_to_app_chart(app, chart, dim);
2233
2234 if (unlikely(dim->value_ptr)) {
2235 - debug(D_STATSD, "updating dimension '%s' (%s) of chart '%s' (%s) for app '%s' with value " COLLECTED_NUMBER_FORMAT, dim->name, rrddim_id(dim->rd), chart->id, rrdset_id(chart->st), app->name, *dim->value_ptr);
2235 + netdata_log_debug(D_STATSD, "updating dimension '%s' (%s) of chart '%s' (%s) for app '%s' with value " COLLECTED_NUMBER_FORMAT, dim->name, rrddim_id(dim->rd), chart->id, rrdset_id(chart->st), app->name, *dim->value_ptr);
2236 rrddim_set_by_pointer(chart->st, dim->rd, *dim->value_ptr);
2237 }
2238 }
2239 }
2240
2241 rrdset_done(chart->st);
2242 - debug(D_STATSD, "completed update of chart '%s' for app '%s'", chart->id, app->name);
2242 + netdata_log_debug(D_STATSD, "completed update of chart '%s' for app '%s'", chart->id, app->name);
2243 }
2244
2245 static inline void statsd_update_all_app_charts(void) {
2246 - // debug(D_STATSD, "updating app charts");
2246 + // netdata_log_debug(D_STATSD, "updating app charts");
2247
2248 STATSD_APP *app;
2249 for(app = statsd.apps; app ;app = app->next) {
2250 - // debug(D_STATSD, "updating charts for app '%s'", app->name);
2250 + // netdata_log_debug(D_STATSD, "updating charts for app '%s'", app->name);
2251
2252 STATSD_APP_CHART *chart;
2253 for(chart = app->charts; chart ;chart = chart->next) {
@@ -2257,7 +2257,7 @@ static inline void statsd_update_all_app_charts(void) {
2257 }
2258 }
2259
2260 - // debug(D_STATSD, "completed update of app charts");
2260 + // netdata_log_debug(D_STATSD, "completed update of app charts");
2261 }
2262
2263 const char *statsd_metric_type_string(STATSD_METRIC_TYPE type) {
@@ -2290,7 +2290,7 @@ static inline void statsd_flush_index_metrics(STATSD_INDEX *index, void (*flush_
2290
2291 if(unlikely(!(m->options & STATSD_METRIC_OPTION_PRIVATE_CHART_CHECKED))) {
2292 if(unlikely(statsd.private_charts >= statsd.max_private_charts_hard)) {
2293 - debug(D_STATSD, "STATSD: metric '%s' will not be charted, because the hard limit of the maximum number "
2293 + netdata_log_debug(D_STATSD, "STATSD: metric '%s' will not be charted, because the hard limit of the maximum number "
2294 "of charts has been reached.", m->name);
2295
2296 collector_info("STATSD: metric '%s' will not be charted, because the hard limit of the maximum number "
@@ -2301,10 +2301,10 @@ static inline void statsd_flush_index_metrics(STATSD_INDEX *index, void (*flush_
2301 }
2302 else {
2303 if (simple_pattern_matches(statsd.charts_for, m->name)) {
2304 - debug(D_STATSD, "STATSD: metric '%s' will be charted.", m->name);
2304 + netdata_log_debug(D_STATSD, "STATSD: metric '%s' will be charted.", m->name);
2305 m->options |= STATSD_METRIC_OPTION_PRIVATE_CHART_ENABLED;
2306 } else {
2307 - debug(D_STATSD, "STATSD: metric '%s' will not be charted.", m->name);
2307 + netdata_log_debug(D_STATSD, "STATSD: metric '%s' will not be charted.", m->name);
2308 m->options &= ~STATSD_METRIC_OPTION_PRIVATE_CHART_ENABLED;
2309 }
2310 }
collectors/tc.plugin/plugin_tc.c
+30 -30
@@ -174,7 +174,7 @@ static inline struct tc_device *tc_device_index_find(const char *id) {
174 // ----------------------------------------------------------------------------
175
176 static inline void tc_class_free(struct tc_device *n, struct tc_class *c) {
177 - debug(D_TC_LOOP, "Removing from device '%s' class '%s', parentid '%s', leafid '%s', unused=%d",
177 + netdata_log_debug(D_TC_LOOP, "Removing from device '%s' class '%s', parentid '%s', leafid '%s', unused=%d",
178 string2str(n->id), string2str(c->id), string2str(c->parentid), string2str(c->leafid),
179 c->unupdated);
180
@@ -271,7 +271,7 @@ static inline void tc_device_commit(struct tc_device *d) {
271 dfe_done(c);
272
273 if(unlikely(!d->enabled || (!updated_classes && !updated_qdiscs))) {
274 - debug(D_TC_LOOP, "TC: Ignoring TC device '%s'. It is not enabled/updated.", string2str(d->name?d->name:d->id));
274 + netdata_log_debug(D_TC_LOOP, "TC: Ignoring TC device '%s'. It is not enabled/updated.", string2str(d->name?d->name:d->id));
275 tc_device_classes_cleanup(d);
276 return;
277 }
@@ -308,7 +308,7 @@ static inline void tc_device_commit(struct tc_device *d) {
308 if(unlikely(!c->updated))
309 continue;
310
311 - //debug(D_TC_LOOP, "TC: In device '%s', %s '%s' has leafid: '%s' and parentid '%s'.",
311 + //netdata_log_debug(D_TC_LOOP, "TC: In device '%s', %s '%s' has leafid: '%s' and parentid '%s'.",
312 // d->id,
313 // c->isqdisc?"qdisc":"class",
314 // c->id,
@@ -326,7 +326,7 @@ static inline void tc_device_commit(struct tc_device *d) {
326
327 if((x->parentid && c->id == x->parentid) ||
328 (c->leafid && x->parentid && c->leafid == x->parentid)) {
329 - // debug(D_TC_LOOP, "TC: In device '%s', %s '%s' (leafid: '%s') has as leaf %s '%s' (parentid: '%s').", d->name?d->name:d->id, c->isqdisc?"qdisc":"class", c->name?c->name:c->id, c->leafid?c->leafid:c->id, x->isqdisc?"qdisc":"class", x->name?x->name:x->id, x->parentid?x->parentid:x->id);
329 + // netdata_log_debug(D_TC_LOOP, "TC: In device '%s', %s '%s' (leafid: '%s') has as leaf %s '%s' (parentid: '%s').", d->name?d->name:d->id, c->isqdisc?"qdisc":"class", c->name?c->name:c->id, c->leafid?c->leafid:c->id, x->isqdisc?"qdisc":"class", x->name?x->name:x->id, x->parentid?x->parentid:x->id);
330 c->isleaf = false;
331 x->hasparent = true;
332 }
@@ -340,7 +340,7 @@ static inline void tc_device_commit(struct tc_device *d) {
340 if(unlikely(!c->updated))
341 continue;
342
343 - // debug(D_TC_LOOP, "TC: device '%s', %s '%s' isleaf=%d, hasparent=%d", d->id, (c->isqdisc)?"qdisc":"class", c->id, c->isleaf, c->hasparent);
343 + // netdata_log_debug(D_TC_LOOP, "TC: device '%s', %s '%s' isleaf=%d, hasparent=%d", d->id, (c->isqdisc)?"qdisc":"class", c->id, c->isleaf, c->hasparent);
344
345 if(unlikely((c->isleaf && c->hasparent) || d->enabled_all_classes_qdiscs)) {
346 c->render = true;
@@ -355,7 +355,7 @@ static inline void tc_device_commit(struct tc_device *d) {
355 //if(unlikely(!c->hasparent)) {
356 // if(root) collector_error("TC: multiple root class/qdisc for device '%s' (old: '%s', new: '%s')", d->id, root->id, c->id);
357 // root = c;
358 - // debug(D_TC_LOOP, "TC: found root class/qdisc '%s'", root->id);
358 + // netdata_log_debug(D_TC_LOOP, "TC: found root class/qdisc '%s'", root->id);
359 //}
360 }
361 dfe_done(c);
@@ -365,8 +365,8 @@ static inline void tc_device_commit(struct tc_device *d) {
365
366 if(unlikely(debug_flags & D_TC_LOOP)) {
367 dfe_start_read(d->classes, c) {
368 - if(c->render) debug(D_TC_LOOP, "TC: final nodes dump for '%s': class %s, OK", string2str(d->name), string2str(c->id));
369 - else debug(D_TC_LOOP, "TC: final nodes dump for '%s': class '%s', IGNORE (updated: %d, isleaf: %d, hasparent: %d, parent: '%s')",
368 + if(c->render) netdata_log_debug(D_TC_LOOP, "TC: final nodes dump for '%s': class %s, OK", string2str(d->name), string2str(c->id));
369 + else netdata_log_debug(D_TC_LOOP, "TC: final nodes dump for '%s': class '%s', IGNORE (updated: %d, isleaf: %d, hasparent: %d, parent: '%s')",
370 string2str(d->name?d->name:d->id), string2str(c->id), c->updated, c->isleaf, c->hasparent, string2str(c->parentid));
371 }
372 dfe_done(c);
@@ -374,12 +374,12 @@ static inline void tc_device_commit(struct tc_device *d) {
374 #endif
375
376 if(unlikely(!active_nodes)) {
377 - debug(D_TC_LOOP, "TC: Ignoring TC device '%s'. No useful classes/qdiscs.", string2str(d->name?d->name:d->id));
377 + netdata_log_debug(D_TC_LOOP, "TC: Ignoring TC device '%s'. No useful classes/qdiscs.", string2str(d->name?d->name:d->id));
378 tc_device_classes_cleanup(d);
379 return;
380 }
381
382 - debug(D_TC_LOOP, "TC: evaluating TC device '%s'. enabled = %d/%d (bytes: %d/%d, packets: %d/%d, dropped: %d/%d, tokens: %d/%d, ctokens: %d/%d, all_classes_qdiscs: %d/%d), classes: (bytes = %llu, packets = %llu, dropped = %llu, tokens = %llu, ctokens = %llu).",
382 + netdata_log_debug(D_TC_LOOP, "TC: evaluating TC device '%s'. enabled = %d/%d (bytes: %d/%d, packets: %d/%d, dropped: %d/%d, tokens: %d/%d, ctokens: %d/%d, all_classes_qdiscs: %d/%d), classes: (bytes = %llu, packets = %llu, dropped = %llu, tokens = %llu, ctokens = %llu).",
383 string2str(d->name?d->name:d->id),
384 d->enabled, enable_new_interfaces,
385 d->enabled_bytes, enable_bytes,
@@ -676,7 +676,7 @@ static inline void tc_device_commit(struct tc_device *d) {
676 rrdlabels_add(d->st_ctokens->rrdlabels, "device_group", string2str(d->family?d->family:d->id), RRDLABEL_SRC_AUTO);
677 }
678 else {
679 - debug(D_TC_LOOP, "TC: Updating _ctokens chart for device '%s'", string2str(d->name?d->name:d->id));
679 + netdata_log_debug(D_TC_LOOP, "TC: Updating _ctokens chart for device '%s'", string2str(d->name?d->name:d->id));
680
681 if(unlikely(d->name_updated)) {
682 char name[RRD_ID_LENGTH_MAX + 1];
@@ -724,7 +724,7 @@ static inline void tc_device_set_class_name(struct tc_device *d, char *id, char
724 }
725
726 if(likely(name && *name && strcmp(string2str(c->id), name) != 0)) {
727 - debug(D_TC_LOOP, "TC: Setting device '%s', class '%s' name to '%s'", string2str(d->id), id, name);
727 + netdata_log_debug(D_TC_LOOP, "TC: Setting device '%s', class '%s' name to '%s'", string2str(d->id), id, name);
728 c->name = string_strdupz(name);
729 c->name_updated = true;
730 }
@@ -741,7 +741,7 @@ static inline void tc_device_set_device_name(struct tc_device *d, char *name) {
741 }
742
743 if(likely(name && *name && strcmp(string2str(d->id), name) != 0)) {
744 - debug(D_TC_LOOP, "TC: Setting device '%s' name to '%s'", string2str(d->id), name);
744 + netdata_log_debug(D_TC_LOOP, "TC: Setting device '%s' name to '%s'", string2str(d->id), name);
745 d->name = string_strdupz(name);
746 d->name_updated = true;
747 }
@@ -752,7 +752,7 @@ static inline void tc_device_set_device_family(struct tc_device *d, char *family
752 d->family = NULL;
753
754 if(likely(family && *family && strcmp(string2str(d->id), family) != 0)) {
755 - debug(D_TC_LOOP, "TC: Setting device '%s' family to '%s'", string2str(d->id), family);
755 + netdata_log_debug(D_TC_LOOP, "TC: Setting device '%s' family to '%s'", string2str(d->id), family);
756 d->family = string_strdupz(family);
757 d->family_updated = true;
758 }
@@ -763,7 +763,7 @@ static inline struct tc_device *tc_device_create(char *id) {
763 struct tc_device *d = tc_device_index_find(id);
764
765 if(!d) {
766 - debug(D_TC_LOOP, "TC: Creating device '%s'", id);
766 + netdata_log_debug(D_TC_LOOP, "TC: Creating device '%s'", id);
767
768 struct tc_device tmp = {
769 .id = string_strdupz(id),
@@ -779,7 +779,7 @@ static inline struct tc_class *tc_class_add(struct tc_device *n, char *id, bool
779 struct tc_class *c = tc_class_index_find(n, id);
780
781 if(!c) {
782 - debug(D_TC_LOOP, "TC: Creating in device '%s', class id '%s', parentid '%s', leafid '%s'",
782 + netdata_log_debug(D_TC_LOOP, "TC: Creating in device '%s', class id '%s', parentid '%s', leafid '%s'",
783 string2str(n->id), id, parentid?parentid:"", leafid?leafid:"");
784
785 struct tc_class tmp = {
@@ -936,7 +936,7 @@ void *tc_main(void *ptr) {
936 struct tc_class *class = NULL;
937
938 snprintfz(command, TC_LINE_MAX, "exec %s %d", tc_script, localhost->rrd_update_every);
939 - debug(D_TC_LOOP, "executing '%s'", command);
939 + netdata_log_debug(D_TC_LOOP, "executing '%s'", command);
940
941 fp_child_output = netdata_popen(command, (pid_t *)&tc_child_pid, &fp_child_input);
942 if(unlikely(!fp_child_output)) {
@@ -949,23 +949,23 @@ void *tc_main(void *ptr) {
949 if(unlikely(!service_running(SERVICE_COLLECTORS))) break;
950
951 buffer[TC_LINE_MAX] = '\0';
952 - // debug(D_TC_LOOP, "TC: read '%s'", buffer);
952 + // netdata_log_debug(D_TC_LOOP, "TC: read '%s'", buffer);
953
954 tc_split_words(buffer, words, PLUGINSD_MAX_WORDS);
955
956 if(unlikely(!words[0] || !*words[0])) {
957 - // debug(D_TC_LOOP, "empty line");
957 + // netdata_log_debug(D_TC_LOOP, "empty line");
958 worker_is_idle();
959 continue;
960 }
961 - // else debug(D_TC_LOOP, "First word is '%s'", words[0]);
961 + // else netdata_log_debug(D_TC_LOOP, "First word is '%s'", words[0]);
962
963 first_hash = simple_hash(words[0]);
964
965 if(unlikely(device && ((first_hash == CLASS_HASH && strcmp(words[0], "class") == 0) || (first_hash == QDISC_HASH && strcmp(words[0], "qdisc") == 0)))) {
966 worker_is_busy(WORKER_TC_CLASS);
967
968 - // debug(D_TC_LOOP, "CLASS line on class id='%s', parent='%s', parentid='%s', leaf='%s', leafid='%s'", words[2], words[3], words[4], words[5], words[6]);
968 + // netdata_log_debug(D_TC_LOOP, "CLASS line on class id='%s', parent='%s', parentid='%s', leaf='%s', leafid='%s'", words[2], words[3], words[4], words[5], words[6]);
969
970 char *type = words[1]; // the class/qdisc type: htb, fq_codel, etc
971 char *id = words[2]; // the class/qdisc major:minor
@@ -1033,7 +1033,7 @@ void *tc_main(void *ptr) {
1033 else if(unlikely(first_hash == END_HASH && strcmp(words[0], "END") == 0)) {
1034 worker_is_busy(WORKER_TC_END);
1035
1036 - // debug(D_TC_LOOP, "END line");
1036 + // netdata_log_debug(D_TC_LOOP, "END line");
1037
1038 if(likely(device)) {
1039 netdata_thread_disable_cancelability();
@@ -1048,7 +1048,7 @@ void *tc_main(void *ptr) {
1048 else if(unlikely(first_hash == BEGIN_HASH && strcmp(words[0], "BEGIN") == 0)) {
1049 worker_is_busy(WORKER_TC_BEGIN);
1050
1051 - // debug(D_TC_LOOP, "BEGIN line on device '%s'", words[1]);
1051 + // netdata_log_debug(D_TC_LOOP, "BEGIN line on device '%s'", words[1]);
1052
1053 if(likely(words[1] && *words[1])) {
1054 device = tc_device_create(words[1]);
@@ -1063,7 +1063,7 @@ void *tc_main(void *ptr) {
1063 else if(unlikely(device && class && first_hash == SENT_HASH && strcmp(words[0], "Sent") == 0)) {
1064 worker_is_busy(WORKER_TC_SENT);
1065
1066 - // debug(D_TC_LOOP, "SENT line '%s'", words[1]);
1066 + // netdata_log_debug(D_TC_LOOP, "SENT line '%s'", words[1]);
1067 if(likely(words[1] && *words[1])) {
1068 class->bytes = str2ull(words[1], NULL);
1069 class->updated = true;
@@ -1087,7 +1087,7 @@ void *tc_main(void *ptr) {
1087 else if(unlikely(device && class && class->updated && first_hash == LENDED_HASH && strcmp(words[0], "lended:") == 0)) {
1088 worker_is_busy(WORKER_TC_LENDED);
1089
1090 - // debug(D_TC_LOOP, "LENDED line '%s'", words[1]);
1090 + // netdata_log_debug(D_TC_LOOP, "LENDED line '%s'", words[1]);
1091 //if(likely(words[1] && *words[1]))
1092 // class->lended = str2ull(words[1]);
1093
@@ -1100,7 +1100,7 @@ void *tc_main(void *ptr) {
1100 else if(unlikely(device && class && class->updated && first_hash == TOKENS_HASH && strcmp(words[0], "tokens:") == 0)) {
1101 worker_is_busy(WORKER_TC_TOKENS);
1102
1103 - // debug(D_TC_LOOP, "TOKENS line '%s'", words[1]);
1103 + // netdata_log_debug(D_TC_LOOP, "TOKENS line '%s'", words[1]);
1104 if(likely(words[1] && *words[1]))
1105 class->tokens = str2ull(words[1], NULL);
1106
@@ -1110,21 +1110,21 @@ void *tc_main(void *ptr) {
1110 else if(unlikely(device && first_hash == SETDEVICENAME_HASH && strcmp(words[0], "SETDEVICENAME") == 0)) {
1111 worker_is_busy(WORKER_TC_SETDEVICENAME);
1112
1113 - // debug(D_TC_LOOP, "SETDEVICENAME line '%s'", words[1]);
1113 + // netdata_log_debug(D_TC_LOOP, "SETDEVICENAME line '%s'", words[1]);
1114 if(likely(words[1] && *words[1]))
1115 tc_device_set_device_name(device, words[1]);
1116 }
1117 else if(unlikely(device && first_hash == SETDEVICEGROUP_HASH && strcmp(words[0], "SETDEVICEGROUP") == 0)) {
1118 worker_is_busy(WORKER_TC_SETDEVICEGROUP);
1119
1120 - // debug(D_TC_LOOP, "SETDEVICEGROUP line '%s'", words[1]);
1120 + // netdata_log_debug(D_TC_LOOP, "SETDEVICEGROUP line '%s'", words[1]);
1121 if(likely(words[1] && *words[1]))
1122 tc_device_set_device_family(device, words[1]);
1123 }
1124 else if(unlikely(device && first_hash == SETCLASSNAME_HASH && strcmp(words[0], "SETCLASSNAME") == 0)) {
1125 worker_is_busy(WORKER_TC_SETCLASSNAME);
1126
1127 - // debug(D_TC_LOOP, "SETCLASSNAME line '%s' '%s'", words[1], words[2]);
1127 + // netdata_log_debug(D_TC_LOOP, "SETCLASSNAME line '%s' '%s'", words[1], words[2]);
1128 char *id = words[1];
1129 char *path = words[2];
1130 if(likely(id && *id && path && *path))
@@ -1147,7 +1147,7 @@ void *tc_main(void *ptr) {
1147 worker_set_metric(WORKER_TC_CLASSES, number_of_classes);
1148 }
1149 //else {
1150 - // debug(D_TC_LOOP, "IGNORED line");
1150 + // netdata_log_debug(D_TC_LOOP, "IGNORED line");
1151 //}
1152
1153 worker_is_idle();
daemon/analytics.c
+42 -42
@@ -24,45 +24,45 @@ struct array_printer {
24 */
25 void analytics_log_data(void)
26 {
27 - debug(D_ANALYTICS, "NETDATA_CONFIG_STREAM_ENABLED : [%s]", analytics_data.netdata_config_stream_enabled);
28 - debug(D_ANALYTICS, "NETDATA_CONFIG_MEMORY_MODE : [%s]", analytics_data.netdata_config_memory_mode);
29 - debug(D_ANALYTICS, "NETDATA_CONFIG_EXPORTING_ENABLED : [%s]", analytics_data.netdata_config_exporting_enabled);
30 - debug(D_ANALYTICS, "NETDATA_EXPORTING_CONNECTORS : [%s]", analytics_data.netdata_exporting_connectors);
31 - debug(D_ANALYTICS, "NETDATA_ALLMETRICS_PROMETHEUS_USED : [%s]", analytics_data.netdata_allmetrics_prometheus_used);
32 - debug(D_ANALYTICS, "NETDATA_ALLMETRICS_SHELL_USED : [%s]", analytics_data.netdata_allmetrics_shell_used);
33 - debug(D_ANALYTICS, "NETDATA_ALLMETRICS_JSON_USED : [%s]", analytics_data.netdata_allmetrics_json_used);
34 - debug(D_ANALYTICS, "NETDATA_DASHBOARD_USED : [%s]", analytics_data.netdata_dashboard_used);
35 - debug(D_ANALYTICS, "NETDATA_COLLECTORS : [%s]", analytics_data.netdata_collectors);
36 - debug(D_ANALYTICS, "NETDATA_COLLECTORS_COUNT : [%s]", analytics_data.netdata_collectors_count);
37 - debug(D_ANALYTICS, "NETDATA_BUILDINFO : [%s]", analytics_data.netdata_buildinfo);
38 - debug(D_ANALYTICS, "NETDATA_CONFIG_PAGE_CACHE_SIZE : [%s]", analytics_data.netdata_config_page_cache_size);
39 - debug(D_ANALYTICS, "NETDATA_CONFIG_MULTIDB_DISK_QUOTA : [%s]", analytics_data.netdata_config_multidb_disk_quota);
40 - debug(D_ANALYTICS, "NETDATA_CONFIG_HTTPS_ENABLED : [%s]", analytics_data.netdata_config_https_enabled);
41 - debug(D_ANALYTICS, "NETDATA_CONFIG_WEB_ENABLED : [%s]", analytics_data.netdata_config_web_enabled);
42 - debug(D_ANALYTICS, "NETDATA_CONFIG_RELEASE_CHANNEL : [%s]", analytics_data.netdata_config_release_channel);
43 - debug(D_ANALYTICS, "NETDATA_MIRRORED_HOST_COUNT : [%s]", analytics_data.netdata_mirrored_host_count);
44 - debug(D_ANALYTICS, "NETDATA_MIRRORED_HOSTS_REACHABLE : [%s]", analytics_data.netdata_mirrored_hosts_reachable);
45 - debug(D_ANALYTICS, "NETDATA_MIRRORED_HOSTS_UNREACHABLE : [%s]", analytics_data.netdata_mirrored_hosts_unreachable);
46 - debug(D_ANALYTICS, "NETDATA_NOTIFICATION_METHODS : [%s]", analytics_data.netdata_notification_methods);
47 - debug(D_ANALYTICS, "NETDATA_ALARMS_NORMAL : [%s]", analytics_data.netdata_alarms_normal);
48 - debug(D_ANALYTICS, "NETDATA_ALARMS_WARNING : [%s]", analytics_data.netdata_alarms_warning);
49 - debug(D_ANALYTICS, "NETDATA_ALARMS_CRITICAL : [%s]", analytics_data.netdata_alarms_critical);
50 - debug(D_ANALYTICS, "NETDATA_CHARTS_COUNT : [%s]", analytics_data.netdata_charts_count);
51 - debug(D_ANALYTICS, "NETDATA_METRICS_COUNT : [%s]", analytics_data.netdata_metrics_count);
52 - debug(D_ANALYTICS, "NETDATA_CONFIG_IS_PARENT : [%s]", analytics_data.netdata_config_is_parent);
53 - debug(D_ANALYTICS, "NETDATA_CONFIG_HOSTS_AVAILABLE : [%s]", analytics_data.netdata_config_hosts_available);
54 - debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_AVAILABLE : [%s]", analytics_data.netdata_host_cloud_available);
55 - debug(D_ANALYTICS, "NETDATA_HOST_ACLK_AVAILABLE : [%s]", analytics_data.netdata_host_aclk_available);
56 - debug(D_ANALYTICS, "NETDATA_HOST_ACLK_PROTOCOL : [%s]", analytics_data.netdata_host_aclk_protocol);
57 - debug(D_ANALYTICS, "NETDATA_HOST_ACLK_IMPLEMENTATION : [%s]", analytics_data.netdata_host_aclk_implementation);
58 - debug(D_ANALYTICS, "NETDATA_HOST_AGENT_CLAIMED : [%s]", analytics_data.netdata_host_agent_claimed);
59 - debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_ENABLED : [%s]", analytics_data.netdata_host_cloud_enabled);
60 - debug(D_ANALYTICS, "NETDATA_CONFIG_HTTPS_AVAILABLE : [%s]", analytics_data.netdata_config_https_available);
61 - debug(D_ANALYTICS, "NETDATA_INSTALL_TYPE : [%s]", analytics_data.netdata_install_type);
62 - debug(D_ANALYTICS, "NETDATA_PREBUILT_DISTRO : [%s]", analytics_data.netdata_prebuilt_distro);
63 - debug(D_ANALYTICS, "NETDATA_CONFIG_IS_PRIVATE_REGISTRY : [%s]", analytics_data.netdata_config_is_private_registry);
64 - debug(D_ANALYTICS, "NETDATA_CONFIG_USE_PRIVATE_REGISTRY: [%s]", analytics_data.netdata_config_use_private_registry);
65 - debug(D_ANALYTICS, "NETDATA_CONFIG_OOM_SCORE : [%s]", analytics_data.netdata_config_oom_score);
27 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_STREAM_ENABLED : [%s]", analytics_data.netdata_config_stream_enabled);
28 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_MEMORY_MODE : [%s]", analytics_data.netdata_config_memory_mode);
29 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_EXPORTING_ENABLED : [%s]", analytics_data.netdata_config_exporting_enabled);
30 + netdata_log_debug(D_ANALYTICS, "NETDATA_EXPORTING_CONNECTORS : [%s]", analytics_data.netdata_exporting_connectors);
31 + netdata_log_debug(D_ANALYTICS, "NETDATA_ALLMETRICS_PROMETHEUS_USED : [%s]", analytics_data.netdata_allmetrics_prometheus_used);
32 + netdata_log_debug(D_ANALYTICS, "NETDATA_ALLMETRICS_SHELL_USED : [%s]", analytics_data.netdata_allmetrics_shell_used);
33 + netdata_log_debug(D_ANALYTICS, "NETDATA_ALLMETRICS_JSON_USED : [%s]", analytics_data.netdata_allmetrics_json_used);
34 + netdata_log_debug(D_ANALYTICS, "NETDATA_DASHBOARD_USED : [%s]", analytics_data.netdata_dashboard_used);
35 + netdata_log_debug(D_ANALYTICS, "NETDATA_COLLECTORS : [%s]", analytics_data.netdata_collectors);
36 + netdata_log_debug(D_ANALYTICS, "NETDATA_COLLECTORS_COUNT : [%s]", analytics_data.netdata_collectors_count);
37 + netdata_log_debug(D_ANALYTICS, "NETDATA_BUILDINFO : [%s]", analytics_data.netdata_buildinfo);
38 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_PAGE_CACHE_SIZE : [%s]", analytics_data.netdata_config_page_cache_size);
39 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_MULTIDB_DISK_QUOTA : [%s]", analytics_data.netdata_config_multidb_disk_quota);
40 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_HTTPS_ENABLED : [%s]", analytics_data.netdata_config_https_enabled);
41 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_WEB_ENABLED : [%s]", analytics_data.netdata_config_web_enabled);
42 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_RELEASE_CHANNEL : [%s]", analytics_data.netdata_config_release_channel);
43 + netdata_log_debug(D_ANALYTICS, "NETDATA_MIRRORED_HOST_COUNT : [%s]", analytics_data.netdata_mirrored_host_count);
44 + netdata_log_debug(D_ANALYTICS, "NETDATA_MIRRORED_HOSTS_REACHABLE : [%s]", analytics_data.netdata_mirrored_hosts_reachable);
45 + netdata_log_debug(D_ANALYTICS, "NETDATA_MIRRORED_HOSTS_UNREACHABLE : [%s]", analytics_data.netdata_mirrored_hosts_unreachable);
46 + netdata_log_debug(D_ANALYTICS, "NETDATA_NOTIFICATION_METHODS : [%s]", analytics_data.netdata_notification_methods);
47 + netdata_log_debug(D_ANALYTICS, "NETDATA_ALARMS_NORMAL : [%s]", analytics_data.netdata_alarms_normal);
48 + netdata_log_debug(D_ANALYTICS, "NETDATA_ALARMS_WARNING : [%s]", analytics_data.netdata_alarms_warning);
49 + netdata_log_debug(D_ANALYTICS, "NETDATA_ALARMS_CRITICAL : [%s]", analytics_data.netdata_alarms_critical);
50 + netdata_log_debug(D_ANALYTICS, "NETDATA_CHARTS_COUNT : [%s]", analytics_data.netdata_charts_count);
51 + netdata_log_debug(D_ANALYTICS, "NETDATA_METRICS_COUNT : [%s]", analytics_data.netdata_metrics_count);
52 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_IS_PARENT : [%s]", analytics_data.netdata_config_is_parent);
53 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_HOSTS_AVAILABLE : [%s]", analytics_data.netdata_config_hosts_available);
54 + netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_AVAILABLE : [%s]", analytics_data.netdata_host_cloud_available);
55 + netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_ACLK_AVAILABLE : [%s]", analytics_data.netdata_host_aclk_available);
56 + netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_ACLK_PROTOCOL : [%s]", analytics_data.netdata_host_aclk_protocol);
57 + netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_ACLK_IMPLEMENTATION : [%s]", analytics_data.netdata_host_aclk_implementation);
58 + netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_AGENT_CLAIMED : [%s]", analytics_data.netdata_host_agent_claimed);
59 + netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_ENABLED : [%s]", analytics_data.netdata_host_cloud_enabled);
60 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_HTTPS_AVAILABLE : [%s]", analytics_data.netdata_config_https_available);
61 + netdata_log_debug(D_ANALYTICS, "NETDATA_INSTALL_TYPE : [%s]", analytics_data.netdata_install_type);
62 + netdata_log_debug(D_ANALYTICS, "NETDATA_PREBUILT_DISTRO : [%s]", analytics_data.netdata_prebuilt_distro);
63 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_IS_PRIVATE_REGISTRY : [%s]", analytics_data.netdata_config_is_private_registry);
64 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_USE_PRIVATE_REGISTRY: [%s]", analytics_data.netdata_config_use_private_registry);
65 + netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_OOM_SCORE : [%s]", analytics_data.netdata_config_oom_score);
66 }
67
68 /*
@@ -323,7 +323,7 @@ void analytics_alarms_notifications(void)
323
324 pid_t command_pid;
325
326 - debug(D_ANALYTICS, "Executing %s", script);
326 + netdata_log_debug(D_ANALYTICS, "Executing %s", script);
327
328 BUFFER *b = buffer_create(1000, NULL);
329 int cnt = 0;
@@ -561,7 +561,7 @@ void analytics_main_cleanup(void *ptr)
561 struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
562 static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
563
564 - debug(D_ANALYTICS, "Cleaning up...");
564 + netdata_log_debug(D_ANALYTICS, "Cleaning up...");
565 analytics_free_data();
566
567 static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
@@ -581,7 +581,7 @@ void *analytics_main(void *ptr)
581 heartbeat_init(&hb);
582 usec_t step_ut = USEC_PER_SEC;
583
584 - debug(D_ANALYTICS, "Analytics thread starts");
584 + netdata_log_debug(D_ANALYTICS, "Analytics thread starts");
585
586 //first delay after agent start
587 while (service_running(SERVICE_ANALYTICS) && likely(sec <= ANALYTICS_INIT_SLEEP_SEC)) {
daemon/daemon.c
+4 -2
@@ -286,7 +286,8 @@ static void process_nice_level(void) {
286 int nice_level = (int)config_get_number(CONFIG_SECTION_GLOBAL, "process nice level", 19);
287 if(nice(nice_level) == -1)
288 netdata_log_error("Cannot set netdata CPU nice level to %d.", nice_level);
289 - else debug(D_SYSTEM, "Set netdata nice level to %d.", nice_level);
289 + else
290 + netdata_log_debug(D_SYSTEM, "Set netdata nice level to %d.", nice_level);
291 #endif // HAVE_NICE
292 };
293
@@ -521,7 +522,8 @@ int become_daemon(int dont_fork, const char *user)
522 if(become_user(user, pidfd) != 0) {
523 netdata_log_error("Cannot become user '%s'. Continuing as we are.", user);
524 }
524 - else debug(D_SYSTEM, "Successfully became user '%s'.", user);
525 + else
526 + netdata_log_debug(D_SYSTEM, "Successfully became user '%s'.", user);
527 }
528 else {
529 prepare_required_directories(getuid(), getgid());
daemon/main.c
+8 -7
@@ -611,7 +611,7 @@ void web_server_config_options(void)
611 // killpid kills pid with SIGTERM.
612 int killpid(pid_t pid) {
613 int ret;
614 - debug(D_EXIT, "Request to kill pid %d", pid);
614 + netdata_log_debug(D_EXIT, "Request to kill pid %d", pid);
615
616 errno = 0;
617 ret = kill(pid, SIGTERM);
@@ -1060,7 +1060,7 @@ static void get_netdata_configured_variables() {
1060 }
1061
1062 netdata_configured_hostname = config_get(CONFIG_SECTION_GLOBAL, "hostname", buf);
1063 - debug(D_OPTIONS, "hostname set to '%s'", netdata_configured_hostname);
1063 + netdata_log_debug(D_OPTIONS, "hostname set to '%s'", netdata_configured_hostname);
1064
1065 // ------------------------------------------------------------------------
1066 // get default database update frequency
@@ -1390,7 +1390,7 @@ int main(int argc, char **argv) {
1390 return 1;
1391 }
1392 else {
1393 - debug(D_OPTIONS, "Configuration loaded from %s.", optarg);
1393 + netdata_log_debug(D_OPTIONS, "Configuration loaded from %s.", optarg);
1394 load_cloud_conf(1);
1395 config_loaded = 1;
1396 }
@@ -1876,7 +1876,7 @@ int main(int argc, char **argv) {
1876 setenv("NETDATA_DEBUG_FLAGS", flags, 1);
1877
1878 debug_flags = strtoull(flags, NULL, 0);
1879 - debug(D_OPTIONS, "Debug flags set to '0x%" PRIX64 "'.", debug_flags);
1879 + netdata_log_debug(D_OPTIONS, "Debug flags set to '0x%" PRIX64 "'.", debug_flags);
1880
1881 if(debug_flags != 0) {
1882 struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY };
@@ -2089,10 +2089,11 @@ int main(int argc, char **argv) {
2089
2090 if(st->enabled) {
2091 st->thread = mallocz(sizeof(netdata_thread_t));
2092 - debug(D_SYSTEM, "Starting thread %s.", st->name);
2092 + netdata_log_debug(D_SYSTEM, "Starting thread %s.", st->name);
2093 netdata_thread_create(st->thread, st->name, NETDATA_THREAD_OPTION_DEFAULT, st->start_routine, st);
2094 }
2095 - else debug(D_SYSTEM, "Not starting thread %s.", st->name);
2095 + else
2096 + netdata_log_debug(D_SYSTEM, "Not starting thread %s.", st->name);
2097 }
2098 ml_start_threads();
2099
@@ -2122,7 +2123,7 @@ int main(int argc, char **argv) {
2123 struct netdata_static_thread *st = &static_threads[i];
2124 st->thread = mallocz(sizeof(netdata_thread_t));
2125 st->enabled = 1;
2125 - debug(D_SYSTEM, "Starting thread %s.", st->name);
2126 + netdata_log_debug(D_SYSTEM, "Starting thread %s.", st->name);
2127 netdata_thread_create(st->thread, st->name, NETDATA_THREAD_OPTION_DEFAULT, st->start_routine, st);
2128 }
2129 }
daemon/service.c
+2 -2
@@ -254,7 +254,7 @@ static void service_main_cleanup(void *ptr)
254 struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
255 static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
256
257 - debug(D_SYSTEM, "Cleaning up...");
257 + netdata_log_debug(D_SYSTEM, "Cleaning up...");
258 worker_unregister();
259
260 static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
@@ -290,7 +290,7 @@ void *service_main(void *ptr)
290 heartbeat_init(&hb);
291 usec_t step = USEC_PER_SEC * SERVICE_HEARTBEAT;
292
293 - debug(D_SYSTEM, "Service thread starts");
293 + netdata_log_debug(D_SYSTEM, "Service thread starts");
294
295 while (service_running(SERVICE_MAINTENANCE)) {
296 worker_is_idle();
daemon/signals.c
+1 -1
@@ -125,7 +125,7 @@ static void reap_child(pid_t pid) {
125 siginfo_t i;
126
127 errno = 0;
128 - debug(D_CHILDS, "SIGNAL: reap_child(%d)...", pid);
128 + netdata_log_debug(D_CHILDS, "SIGNAL: reap_child(%d)...", pid);
129 if (netdata_waitid(P_PID, (id_t)pid, &i, WEXITED|WNOHANG) == -1) {
130 if (errno != ECHILD)
131 netdata_log_error("SIGNAL: waitid(%d): failed to wait for child", pid);
database/engine/journalfile.c
+5 -5
@@ -9,12 +9,12 @@ static void after_extent_write_journalfile_v1_io(uv_fs_t* req)
9 struct generic_io_descriptor *io_descr = &wal->io_descr;
10 struct rrdengine_instance *ctx = io_descr->ctx;
11
12 - debug(D_RRDENGINE, "%s: Journal block was written to disk.", __func__);
12 + netdata_log_debug(D_RRDENGINE, "%s: Journal block was written to disk.", __func__);
13 if (req->result < 0) {
14 ctx_io_error(ctx);
15 netdata_log_error("DBENGINE: %s: uv_fs_write: %s", __func__, uv_strerror((int)req->result));
16 } else {
17 - debug(D_RRDENGINE, "%s: Journal block was written to disk.", __func__);
17 + netdata_log_debug(D_RRDENGINE, "%s: Journal block was written to disk.", __func__);
18 }
19
20 uv_fs_req_cleanup(req);
@@ -740,7 +740,7 @@ static unsigned journalfile_replay_transaction(struct rrdengine_instance *ctx, s
740 *id = 0;
741 jf_header = buf;
742 if (STORE_PADDING == jf_header->type) {
743 - debug(D_RRDENGINE, "Skipping padding.");
743 + netdata_log_debug(D_RRDENGINE, "Skipping padding.");
744 return 0;
745 }
746 if (sizeof(*jf_header) > max_size) {
@@ -758,14 +758,14 @@ static unsigned journalfile_replay_transaction(struct rrdengine_instance *ctx, s
758 crc = crc32(0L, Z_NULL, 0);
759 crc = crc32(crc, buf, sizeof(*jf_header) + payload_length);
760 ret = crc32cmp(jf_trailer->checksum, crc);
761 - debug(D_RRDENGINE, "Transaction %"PRIu64" was read from disk. CRC32 check: %s", *id, ret ? "FAILED" : "SUCCEEDED");
761 + netdata_log_debug(D_RRDENGINE, "Transaction %"PRIu64" was read from disk. CRC32 check: %s", *id, ret ? "FAILED" : "SUCCEEDED");
762 if (unlikely(ret)) {
763 netdata_log_error("DBENGINE: transaction %"PRIu64" was read from disk. CRC32 check: FAILED", *id);
764 return size_bytes;
765 }
766 switch (jf_header->type) {
767 case STORE_DATA:
768 - debug(D_RRDENGINE, "Replaying transaction %"PRIu64"", jf_header->id);
768 + netdata_log_debug(D_RRDENGINE, "Replaying transaction %"PRIu64"", jf_header->id);
769 journalfile_restore_extent_metadata(ctx, journalfile, buf + sizeof(*jf_header), payload_length);
770 break;
771 default:
database/engine/rrdengine.c
+1 -1
@@ -1457,7 +1457,7 @@ void async_cb(uv_async_t *handle)
1457 {
1458 uv_stop(handle->loop);
1459 uv_update_time(handle->loop);
1460 - debug(D_RRDENGINE, "%s called, active=%d.", __func__, uv_is_active((uv_handle_t *)handle));
1460 + netdata_log_debug(D_RRDENGINE, "%s called, active=%d.", __func__, uv_is_active((uv_handle_t *)handle));
1461 }
1462
1463 #define TIMER_PERIOD_MS (1000)
database/rrdcalc.c
+7 -7
@@ -206,7 +206,7 @@ RRDCALC *rrdcalc_acquired_to_rrdcalc(const RRDCALC_ACQUIRED *rca) {
206 static void rrdcalc_link_to_rrdset(RRDSET *st, RRDCALC *rc) {
207 RRDHOST *host = st->rrdhost;
208
209 - debug(D_HEALTH, "Health linking alarm '%s.%s' to chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
209 + netdata_log_debug(D_HEALTH, "Health linking alarm '%s.%s' to chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
210
211 rc->last_status_change_value = rc->value;
212 rc->last_status_change = now_realtime_sec();
@@ -222,13 +222,13 @@ static void rrdcalc_link_to_rrdset(RRDSET *st, RRDCALC *rc) {
222 }
223
224 if(!isnan(rc->green) && isnan(st->green)) {
225 - debug(D_HEALTH, "Health alarm '%s.%s' green threshold set from " NETDATA_DOUBLE_FORMAT_AUTO
225 + netdata_log_debug(D_HEALTH, "Health alarm '%s.%s' green threshold set from " NETDATA_DOUBLE_FORMAT_AUTO
226 " to " NETDATA_DOUBLE_FORMAT_AUTO ".", rrdset_id(rc->rrdset), rrdcalc_name(rc), rc->rrdset->green, rc->green);
227 st->green = rc->green;
228 }
229
230 if(!isnan(rc->red) && isnan(st->red)) {
231 - debug(D_HEALTH, "Health alarm '%s.%s' red threshold set from " NETDATA_DOUBLE_FORMAT_AUTO " to " NETDATA_DOUBLE_FORMAT_AUTO
231 + netdata_log_debug(D_HEALTH, "Health alarm '%s.%s' red threshold set from " NETDATA_DOUBLE_FORMAT_AUTO " to " NETDATA_DOUBLE_FORMAT_AUTO
232 ".", rrdset_id(rc->rrdset), rrdcalc_name(rc), rc->rrdset->red, rc->red);
233 st->red = rc->red;
234 }
@@ -317,7 +317,7 @@ static void rrdcalc_unlink_from_rrdset(RRDCALC *rc, bool having_ll_wrlock) {
317 RRDSET *st = rc->rrdset;
318
319 if(!st) {
320 - debug(D_HEALTH, "Requested to unlink RRDCALC '%s.%s' which is not linked to any RRDSET", rrdcalc_chart_name(rc), rrdcalc_name(rc));
320 + netdata_log_debug(D_HEALTH, "Requested to unlink RRDCALC '%s.%s' which is not linked to any RRDSET", rrdcalc_chart_name(rc), rrdcalc_name(rc));
321 netdata_log_error("Requested to unlink RRDCALC '%s.%s' which is not linked to any RRDSET", rrdcalc_chart_name(rc), rrdcalc_name(rc));
322 return;
323 }
@@ -357,7 +357,7 @@ static void rrdcalc_unlink_from_rrdset(RRDCALC *rc, bool having_ll_wrlock) {
357 health_alarm_log_add_entry(host, ae);
358 }
359
360 - debug(D_HEALTH, "Health unlinking alarm '%s.%s' from chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
360 + netdata_log_debug(D_HEALTH, "Health unlinking alarm '%s.%s' from chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
361
362 // unlink it
363
@@ -412,7 +412,7 @@ static inline bool rrdcalc_check_if_it_matches_rrdset(RRDCALC *rc, RRDSET *st) {
412
413 void rrdcalc_link_matching_alerts_to_rrdset(RRDSET *st) {
414 RRDHOST *host = st->rrdhost;
415 - // debug(D_HEALTH, "find matching alarms for chart '%s'", st->id);
415 + // netdata_log_debug(D_HEALTH, "find matching alarms for chart '%s'", st->id);
416
417 RRDCALC *rc;
418 foreach_rrdcalc_in_rrdhost_read(host, rc) {
@@ -557,7 +557,7 @@ static void rrdcalc_rrdhost_insert_callback(const DICTIONARY_ITEM *item __maybe_
557 rc->critical->rrdcalc = rc;
558 }
559
560 - debug(D_HEALTH, "Health added alarm '%s.%s': exec '%s', recipient '%s', green " NETDATA_DOUBLE_FORMAT_AUTO
560 + netdata_log_debug(D_HEALTH, "Health added alarm '%s.%s': exec '%s', recipient '%s', green " NETDATA_DOUBLE_FORMAT_AUTO
561 ", red " NETDATA_DOUBLE_FORMAT_AUTO
562 ", lookup: group %d, after %d, before %d, options %u, dimensions '%s', for each dimension '%s', update every %d, calculation '%s', warning '%s', critical '%s', source '%s', delay up %d, delay down %d, delay max %d, delay_multiplier %f, warn_repeat_every %u, crit_repeat_every %u",
563 rrdcalc_chart_name(rc),
database/rrdcalctemplate.c
+1 -1
@@ -143,7 +143,7 @@ static void rrdcalctemplate_insert_callback(const DICTIONARY_ITEM *item __maybe_
143 bool *added = added_bool;
144 *added = true;
145
146 - debug(D_HEALTH, "Health configuration adding template '%s'"
146 + netdata_log_debug(D_HEALTH, "Health configuration adding template '%s'"
147 ": context '%s'"
148 ", exec '%s'"
149 ", recipient '%s'"
database/rrddim.c
+12 -12
@@ -197,7 +197,7 @@ static void rrddim_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, v
197
198 ml_dimension_delete(rd);
199
200 - debug(D_RRD_CALLS, "rrddim_free() %s.%s", rrdset_name(st), rrddim_name(rd));
200 + netdata_log_debug(D_RRD_CALLS, "rrddim_free() %s.%s", rrdset_name(st), rrddim_name(rd));
201
202 if (!rrddim_finalize_collection_and_check_retention(rd) && rd->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) {
203 /* This metric has no data and no references */
@@ -318,13 +318,13 @@ static inline RRDDIM *rrddim_index_find(RRDSET *st, const char *id) {
318 // RRDDIM - find a dimension
319
320 inline RRDDIM *rrddim_find(RRDSET *st, const char *id) {
321 - debug(D_RRD_CALLS, "rrddim_find() for chart %s, dimension %s", rrdset_name(st), id);
321 + netdata_log_debug(D_RRD_CALLS, "rrddim_find() for chart %s, dimension %s", rrdset_name(st), id);
322
323 return rrddim_index_find(st, id);
324 }
325
326 inline RRDDIM_ACQUIRED *rrddim_find_and_acquire(RRDSET *st, const char *id) {
327 - debug(D_RRD_CALLS, "rrddim_find_and_acquire() for chart %s, dimension %s", rrdset_name(st), id);
327 + netdata_log_debug(D_RRD_CALLS, "rrddim_find_and_acquire() for chart %s, dimension %s", rrdset_name(st), id);
328
329 return (RRDDIM_ACQUIRED *)dictionary_get_and_acquire_item(st->rrddim_root_index, id);
330 }
@@ -361,7 +361,7 @@ inline int rrddim_reset_name(RRDSET *st, RRDDIM *rd, const char *name) {
361 if(unlikely(!name || !*name || !strcmp(rrddim_name(rd), name)))
362 return 0;
363
364 - debug(D_RRD_CALLS, "rrddim_reset_name() from %s.%s to %s.%s", rrdset_name(st), rrddim_name(rd), rrdset_name(st), name);
364 + netdata_log_debug(D_RRD_CALLS, "rrddim_reset_name() from %s.%s to %s.%s", rrdset_name(st), rrddim_name(rd), rrdset_name(st), name);
365
366 STRING *old = rd->name;
367 rd->name = rrd_string_strdupz(name);
@@ -379,7 +379,7 @@ inline int rrddim_set_algorithm(RRDSET *st, RRDDIM *rd, RRD_ALGORITHM algorithm)
379 if(unlikely(rd->algorithm == algorithm))
380 return 0;
381
382 - debug(D_RRD_CALLS, "Updating algorithm of dimension '%s/%s' from %s to %s", rrdset_id(st), rrddim_name(rd), rrd_algorithm_name(rd->algorithm), rrd_algorithm_name(algorithm));
382 + netdata_log_debug(D_RRD_CALLS, "Updating algorithm of dimension '%s/%s' from %s to %s", rrdset_id(st), rrddim_name(rd), rrd_algorithm_name(rd->algorithm), rrd_algorithm_name(algorithm));
383 rd->algorithm = algorithm;
384 rrddim_clear_exposed(rd);
385 rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED);
@@ -392,7 +392,7 @@ inline int rrddim_set_multiplier(RRDSET *st, RRDDIM *rd, int32_t multiplier) {
392 if(unlikely(rd->multiplier == multiplier))
393 return 0;
394
395 - debug(D_RRD_CALLS, "Updating multiplier of dimension '%s/%s' from %d to %d",
395 + netdata_log_debug(D_RRD_CALLS, "Updating multiplier of dimension '%s/%s' from %d to %d",
396 rrdset_id(st), rrddim_name(rd), rd->multiplier, multiplier);
397 rd->multiplier = multiplier;
398 rrddim_clear_exposed(rd);
@@ -406,7 +406,7 @@ inline int rrddim_set_divisor(RRDSET *st, RRDDIM *rd, int32_t divisor) {
406 if(unlikely(rd->divisor == divisor))
407 return 0;
408
409 - debug(D_RRD_CALLS, "Updating divisor of dimension '%s/%s' from %d to %d",
409 + netdata_log_debug(D_RRD_CALLS, "Updating divisor of dimension '%s/%s' from %d to %d",
410 rrdset_id(st), rrddim_name(rd), rd->divisor, divisor);
411 rd->divisor = divisor;
412 rrddim_clear_exposed(rd);
@@ -493,7 +493,7 @@ void rrddim_free(RRDSET *st, RRDDIM *rd) {
493 // RRDDIM - set dimension options
494
495 int rrddim_hide(RRDSET *st, const char *id) {
496 - debug(D_RRD_CALLS, "rrddim_hide() for chart %s, dimension %s", rrdset_name(st), id);
496 + netdata_log_debug(D_RRD_CALLS, "rrddim_hide() for chart %s, dimension %s", rrdset_name(st), id);
497
498 RRDHOST *host = st->rrdhost;
499
@@ -513,7 +513,7 @@ int rrddim_hide(RRDSET *st, const char *id) {
513 }
514
515 int rrddim_unhide(RRDSET *st, const char *id) {
516 - debug(D_RRD_CALLS, "rrddim_unhide() for chart %s, dimension %s", rrdset_name(st), id);
516 + netdata_log_debug(D_RRD_CALLS, "rrddim_unhide() for chart %s, dimension %s", rrdset_name(st), id);
517
518 RRDHOST *host = st->rrdhost;
519 RRDDIM *rd = rrddim_find(st, id);
@@ -533,7 +533,7 @@ int rrddim_unhide(RRDSET *st, const char *id) {
533 }
534
535 inline void rrddim_is_obsolete(RRDSET *st, RRDDIM *rd) {
536 - debug(D_RRD_CALLS, "rrddim_is_obsolete() for chart %s, dimension %s", rrdset_name(st), rrddim_name(rd));
536 + netdata_log_debug(D_RRD_CALLS, "rrddim_is_obsolete() for chart %s, dimension %s", rrdset_name(st), rrddim_name(rd));
537
538 if(unlikely(rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED))) {
539 netdata_log_info("Cannot obsolete already archived dimension %s from chart %s", rrddim_name(rd), rrdset_name(st));
@@ -546,7 +546,7 @@ inline void rrddim_is_obsolete(RRDSET *st, RRDDIM *rd) {
546 }
547
548 inline void rrddim_isnot_obsolete(RRDSET *st __maybe_unused, RRDDIM *rd) {
549 - debug(D_RRD_CALLS, "rrddim_isnot_obsolete() for chart %s, dimension %s", rrdset_name(st), rrddim_name(rd));
549 + netdata_log_debug(D_RRD_CALLS, "rrddim_isnot_obsolete() for chart %s, dimension %s", rrdset_name(st), rrddim_name(rd));
550
551 rrddim_flag_clear(rd, RRDDIM_FLAG_OBSOLETE);
552 rrdcontext_updated_rrddim_flags(rd);
@@ -563,7 +563,7 @@ inline collected_number rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, collected_
563 }
564
565 collected_number rrddim_timed_set_by_pointer(RRDSET *st __maybe_unused, RRDDIM *rd, struct timeval collected_time, collected_number value) {
566 - debug(D_RRD_CALLS, "rrddim_set_by_pointer() for chart %s, dimension %s, value " COLLECTED_NUMBER_FORMAT, rrdset_name(st), rrddim_name(rd), value);
566 + netdata_log_debug(D_RRD_CALLS, "rrddim_set_by_pointer() for chart %s, dimension %s, value " COLLECTED_NUMBER_FORMAT, rrdset_name(st), rrddim_name(rd), value);
567
568 rd->collector.last_collected_time = collected_time;
569 rd->collector.collected_value = value;
database/rrddimvar.c
+2 -2
@@ -249,7 +249,7 @@ void rrddimvar_add_and_leave_released(RRDDIM *rd, RRDVAR_TYPE type, const char *
249 void rrddimvar_rename_all(RRDDIM *rd) {
250 RRDSET *st = rd->rrdset;
251
252 - debug(D_VARIABLES, "RRDDIMVAR rename for chart id '%s' name '%s', dimension id '%s', name '%s'", rrdset_id(st), rrdset_name(st), rrddim_id(rd), rrddim_name(rd));
252 + netdata_log_debug(D_VARIABLES, "RRDDIMVAR rename for chart id '%s' name '%s', dimension id '%s', name '%s'", rrdset_id(st), rrdset_name(st), rrddim_id(rd), rrddim_name(rd));
253
254 RRDDIMVAR *rs;
255 dfe_start_write(st->rrddimvar_root_index, rs) {
@@ -262,7 +262,7 @@ void rrddimvar_rename_all(RRDDIM *rd) {
262 void rrddimvar_delete_all(RRDDIM *rd) {
263 RRDSET *st = rd->rrdset;
264
265 - debug(D_VARIABLES, "RRDDIMVAR delete for chart id '%s' name '%s', dimension id '%s', name '%s'", rrdset_id(st), rrdset_name(st), rrddim_id(rd), rrddim_name(rd));
265 + netdata_log_debug(D_VARIABLES, "RRDDIMVAR delete for chart id '%s' name '%s', dimension id '%s', name '%s'", rrdset_id(st), rrdset_name(st), rrddim_id(rd), rrddim_name(rd));
266
267 RRDDIMVAR *rs;
268 dfe_start_write(st->rrddimvar_root_index, rs) {
database/rrdhost.c
+5 -5
@@ -80,7 +80,7 @@ static inline void rrdhost_init() {
80 }
81
82 RRDHOST_ACQUIRED *rrdhost_find_and_acquire(const char *machine_guid) {
83 - debug(D_RRD_CALLS, "rrdhost_find_and_acquire() host %s", machine_guid);
83 + netdata_log_debug(D_RRD_CALLS, "rrdhost_find_and_acquire() host %s", machine_guid);
84
85 return (RRDHOST_ACQUIRED *)dictionary_get_and_acquire_item(rrdhost_root_index, machine_guid);
86 }
@@ -303,7 +303,7 @@ static RRDHOST *rrdhost_create(
303 int is_localhost,
304 bool archived
305 ) {
306 - debug(D_RRDHOST, "Host '%s': adding with guid '%s'", hostname, guid);
306 + netdata_log_debug(D_RRDHOST, "Host '%s': adding with guid '%s'", hostname, guid);
307
308 if(memory_mode == RRD_MEMORY_MODE_DBENGINE && !dbengine_enabled) {
309 netdata_log_error("memory mode 'dbengine' is not enabled, but host '%s' is configured for it. Falling back to 'alloc'",
@@ -724,7 +724,7 @@ RRDHOST *rrdhost_find_or_create(
724 , struct rrdhost_system_info *system_info
725 , bool archived
726 ) {
727 - debug(D_RRDHOST, "Searching for host '%s' with guid '%s'", hostname, guid);
727 + netdata_log_debug(D_RRDHOST, "Searching for host '%s' with guid '%s'", hostname, guid);
728
729 RRDHOST *host = rrdhost_find_by_guid(guid);
730 if (unlikely(host && host->rrd_memory_mode != mode && rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED))) {
@@ -1033,7 +1033,7 @@ int rrd_init(char *hostname, struct rrdhost_system_info *system_info, bool unitt
1033 if(!unittest)
1034 metadata_sync_init();
1035
1036 - debug(D_RRDHOST, "Initializing localhost with hostname '%s'", hostname);
1036 + netdata_log_debug(D_RRDHOST, "Initializing localhost with hostname '%s'", hostname);
1037 localhost = rrdhost_create(
1038 hostname
1039 , registry_get_this_machine_hostname()
@@ -1455,7 +1455,7 @@ static void rrdhost_load_kubernetes_labels(void) {
1455 return;
1456 }
1457
1458 - debug(D_RRDHOST, "Attempting to fetch external labels via %s", label_script);
1458 + netdata_log_debug(D_RRDHOST, "Attempting to fetch external labels via %s", label_script);
1459
1460 pid_t pid;
1461 FILE *fp_child_input;
database/rrdset.c
+12 -12
@@ -55,7 +55,7 @@ static STRING *rrdset_fix_name(RRDHOST *host, const char *chart_full_id, const c
55 strncpyz(new_name, sanitized_name, CONFIG_MAX_VALUE);
56
57 if(rrdset_index_find_name(host, new_name)) {
58 - debug(D_RRD_CALLS, "RRDSET: chart name '%s' on host '%s' already exists.", new_name, rrdhost_hostname(host));
58 + netdata_log_debug(D_RRD_CALLS, "RRDSET: chart name '%s' on host '%s' already exists.", new_name, rrdhost_hostname(host));
59 if(!strcmp(chart_full_id, full_name) && (!current_name || !*current_name)) {
60 unsigned i = 1;
61
@@ -450,7 +450,7 @@ static RRDSET *rrdset_index_find(RRDHOST *host, const char *id) {
450 // RRDSET - find charts
451
452 inline RRDSET *rrdset_find(RRDHOST *host, const char *id) {
453 - debug(D_RRD_CALLS, "rrdset_find() for chart '%s' in host '%s'", id, rrdhost_hostname(host));
453 + netdata_log_debug(D_RRD_CALLS, "rrdset_find() for chart '%s' in host '%s'", id, rrdhost_hostname(host));
454 RRDSET *st = rrdset_index_find(host, id);
455
456 if(st)
@@ -460,7 +460,7 @@ inline RRDSET *rrdset_find(RRDHOST *host, const char *id) {
460 }
461
462 inline RRDSET *rrdset_find_bytype(RRDHOST *host, const char *type, const char *id) {
463 - debug(D_RRD_CALLS, "rrdset_find_bytype() for chart '%s.%s' in host '%s'", type, id, rrdhost_hostname(host));
463 + netdata_log_debug(D_RRD_CALLS, "rrdset_find_bytype() for chart '%s.%s' in host '%s'", type, id, rrdhost_hostname(host));
464
465 char buf[RRD_ID_LENGTH_MAX + 1];
466 strncpyz(buf, type, RRD_ID_LENGTH_MAX - 1);
@@ -472,13 +472,13 @@ inline RRDSET *rrdset_find_bytype(RRDHOST *host, const char *type, const char *i
472 }
473
474 inline RRDSET *rrdset_find_byname(RRDHOST *host, const char *name) {
475 - debug(D_RRD_CALLS, "rrdset_find_byname() for chart '%s' in host '%s'", name, rrdhost_hostname(host));
475 + netdata_log_debug(D_RRD_CALLS, "rrdset_find_byname() for chart '%s' in host '%s'", name, rrdhost_hostname(host));
476 RRDSET *st = rrdset_index_find_name(host, name);
477 return(st);
478 }
479
480 RRDSET_ACQUIRED *rrdset_find_and_acquire(RRDHOST *host, const char *id) {
481 - debug(D_RRD_CALLS, "rrdset_find_and_acquire() for host %s, chart %s", rrdhost_hostname(host), id);
481 + netdata_log_debug(D_RRD_CALLS, "rrdset_find_and_acquire() for host %s, chart %s", rrdhost_hostname(host), id);
482
483 return (RRDSET_ACQUIRED *)dictionary_get_and_acquire_item(host->rrdset_root_index, id);
484 }
@@ -522,7 +522,7 @@ int rrdset_reset_name(RRDSET *st, const char *name) {
522
523 RRDHOST *host = st->rrdhost;
524
525 - debug(D_RRD_CALLS, "rrdset_reset_name() old: '%s', new: '%s'", rrdset_name(st), name);
525 + netdata_log_debug(D_RRD_CALLS, "rrdset_reset_name() old: '%s', new: '%s'", rrdset_name(st), name);
526
527 STRING *name_string = rrdset_fix_name(host, rrdset_id(st), rrdset_parts_type(st), string2str(st->name), name);
528 if(!name_string) return 0;
@@ -745,7 +745,7 @@ inline void rrdset_update_heterogeneous_flag(RRDSET *st) {
745 // RRDSET - reset a chart
746
747 void rrdset_reset(RRDSET *st) {
748 - debug(D_RRD_CALLS, "rrdset_reset() %s", rrdset_name(st));
748 + netdata_log_debug(D_RRD_CALLS, "rrdset_reset() %s", rrdset_name(st));
749
750 st->last_collected_time.tv_sec = 0;
751 st->last_collected_time.tv_usec = 0;
@@ -933,7 +933,7 @@ RRDSET *rrdset_create_custom(
933 // ------------------------------------------------------------------------
934 // allocate it
935
936 - debug(D_RRD_CALLS, "Creating RRD_STATS for '%s.%s'.", type, id);
936 + netdata_log_debug(D_RRD_CALLS, "Creating RRD_STATS for '%s.%s'.", type, id);
937
938 struct rrdset_constructor tmp = {
939 .host = host,
@@ -1056,7 +1056,7 @@ void rrdset_timed_next(RRDSET *st, struct timeval now, usec_t duration_since_las
1056 #endif
1057 }
1058
1059 - debug(D_RRD_CALLS, "rrdset_timed_next() for chart %s with duration since last update %llu usec", rrdset_name(st), duration_since_last_update);
1059 + netdata_log_debug(D_RRD_CALLS, "rrdset_timed_next() for chart %s with duration since last update %llu usec", rrdset_name(st), duration_since_last_update);
1060 rrdset_debug(st, "NEXT: %llu microseconds", duration_since_last_update);
1061
1062 internal_error(discarded && discarded != duration_since_last_update,
@@ -1514,7 +1514,7 @@ void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next)
1514 if (pending_rrdset_next)
1515 rrdset_timed_next(st, now, 0ULL);
1516
1517 - debug(D_RRD_CALLS, "rrdset_done() for chart '%s'", rrdset_name(st));
1517 + netdata_log_debug(D_RRD_CALLS, "rrdset_done() for chart '%s'", rrdset_name(st));
1518
1519 RRDDIM *rd;
1520
@@ -1666,7 +1666,7 @@ void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next)
1666 // if the new is smaller than the old (an overflow, or reset), set the old equal to the new
1667 // to reset the calculation (it will give zero as the calculation for this second)
1668 if(unlikely(rd->algorithm == RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL && rd->collector.last_collected_value > rd->collector.collected_value)) {
1669 - debug(D_RRD_STATS, "'%s' / '%s': RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
1669 + netdata_log_debug(D_RRD_STATS, "'%s' / '%s': RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
1670 , rrdset_id(st)
1671 , rrddim_name(rd)
1672 , rd->collector.last_collected_value
@@ -1770,7 +1770,7 @@ void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next)
1770 // It is imperative to set the comparison to uint64_t since type collected_number is signed and
1771 // produces wrong results as far as incremental counters are concerned.
1772 if(unlikely((uint64_t)rd->collector.last_collected_value > (uint64_t)rd->collector.collected_value)) {
1773 - debug(D_RRD_STATS, "'%s' / '%s': RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
1773 + netdata_log_debug(D_RRD_STATS, "'%s' / '%s': RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
1774 , rrdset_id(st)
1775 , rrddim_name(rd)
1776 , rd->collector.last_collected_value
database/rrdsetvar.c
+1 -1
@@ -222,7 +222,7 @@ void rrdsetvar_add_and_leave_released(RRDSET *st, const char *name, RRDVAR_TYPE
222 }
223
224 void rrdsetvar_rename_all(RRDSET *st) {
225 - debug(D_VARIABLES, "RRDSETVAR rename for chart id '%s' name '%s'", rrdset_id(st), rrdset_name(st));
225 + netdata_log_debug(D_VARIABLES, "RRDSETVAR rename for chart id '%s' name '%s'", rrdset_id(st), rrdset_name(st));
226
227 RRDSETVAR *rs;
228 dfe_start_write(st->rrdsetvar_root_index, rs) {
database/sqlite/sqlite_aclk.c
+8 -8
@@ -67,7 +67,7 @@ static void aclk_database_enq_cmd(struct aclk_database_cmd *cmd)
67 /* wake up event loop */
68 int rc = uv_async_send(&aclk_sync_config.async);
69 if (unlikely(rc))
70 - debug(D_ACLK_SYNC, "Failed to wake up event loop");
70 + netdata_log_debug(D_ACLK_SYNC, "Failed to wake up event loop");
71 }
72
73 enum {
@@ -226,14 +226,14 @@ static void sql_delete_aclk_table_list(char *host_guid)
226 uuid_unparse_lower(host_uuid, host_str);
227 uuid_unparse_lower_fix(&host_uuid, uuid_str);
228
229 - debug(D_ACLK_SYNC, "Checking if I should delete aclk tables for node %s", host_str);
229 + netdata_log_debug(D_ACLK_SYNC, "Checking if I should delete aclk tables for node %s", host_str);
230
231 if (is_host_available(&host_uuid)) {
232 - debug(D_ACLK_SYNC, "Host %s exists, not deleting aclk sync tables", host_str);
232 + netdata_log_debug(D_ACLK_SYNC, "Host %s exists, not deleting aclk sync tables", host_str);
233 return;
234 }
235
236 - debug(D_ACLK_SYNC, "Host %s does NOT exist, can delete aclk sync tables", host_str);
236 + netdata_log_debug(D_ACLK_SYNC, "Host %s does NOT exist, can delete aclk sync tables", host_str);
237
238 sqlite3_stmt *res = NULL;
239 BUFFER *sql = buffer_create(ACLK_SYNC_QUERY_SIZE, &netdata_buffers_statistics.buffers_sqlite);
@@ -265,7 +265,7 @@ fail:
265
266 static int sql_check_aclk_table(void *data __maybe_unused, int argc __maybe_unused, char **argv __maybe_unused, char **column __maybe_unused)
267 {
268 - debug(D_ACLK_SYNC,"Scheduling aclk sync table check for node %s", (char *) argv[0]);
268 + netdata_log_debug(D_ACLK_SYNC,"Scheduling aclk sync table check for node %s", (char *) argv[0]);
269 struct aclk_database_cmd cmd;
270 memset(&cmd, 0, sizeof(cmd));
271 cmd.opcode = ACLK_DATABASE_DELETE_HOST;
@@ -280,7 +280,7 @@ static int sql_check_aclk_table(void *data __maybe_unused, int argc __maybe_unus
280 static void sql_check_aclk_table_list(void)
281 {
282 char *err_msg = NULL;
283 - debug(D_ACLK_SYNC,"Cleaning tables for nodes that do not exist");
283 + netdata_log_debug(D_ACLK_SYNC,"Cleaning tables for nodes that do not exist");
284 int rc = sqlite3_exec_monitored(db_meta, SQL_SELECT_ACLK_ACTIVE_LIST, sql_check_aclk_table, NULL, &err_msg);
285 if (rc != SQLITE_OK) {
286 error_report("Query failed when trying to check for obsolete ACLK sync tables, %s", err_msg);
@@ -305,7 +305,7 @@ static int sql_maint_aclk_sync_database(void *data __maybe_unused, int argc __ma
305 static void sql_maint_aclk_sync_database_all(void)
306 {
307 char *err_msg = NULL;
308 - debug(D_ACLK_SYNC,"Cleaning tables for nodes that do not exist");
308 + netdata_log_debug(D_ACLK_SYNC,"Cleaning tables for nodes that do not exist");
309 int rc = sqlite3_exec_monitored(db_meta, SQL_SELECT_ACLK_ALERT_LIST, sql_maint_aclk_sync_database, NULL, &err_msg);
310 if (rc != SQLITE_OK) {
311 error_report("Query failed when trying to check for obsolete ACLK sync tables, %s", err_msg);
@@ -444,7 +444,7 @@ static void aclk_synchronization(void *arg __maybe_unused)
444 sql_process_queue_removed_alerts_to_aclk(cmd.param[0]);
445 break;
446 default:
447 - debug(D_ACLK_SYNC, "%s: default.", __func__);
447 + netdata_log_debug(D_ACLK_SYNC, "%s: default.", __func__);
448 break;
449 }
450 if (cmd.completion)
database/sqlite/sqlite_functions.c
+1 -1
@@ -321,7 +321,7 @@ int init_database_batch(sqlite3 *database, int rebuild, int init_type, const cha
321 int rc;
322 char *err_msg = NULL;
323 for (int i = 0; batch[i]; i++) {
324 - debug(D_METADATALOG, "Executing %s", batch[i]);
324 + netdata_log_debug(D_METADATALOG, "Executing %s", batch[i]);
325 rc = sqlite3_exec_monitored(database, batch[i], 0, 0, &err_msg);
326 if (rc != SQLITE_OK) {
327 error_report("SQLite error during database %s, rc = %d (%s)", init_type ? "cleanup" : "setup", rc, err_msg);
exporting/aws_kinesis/aws_kinesis.c
+10 -11
@@ -152,17 +152,16 @@ void aws_kinesis_connector_worker(void *instance_p)
152 }
153 char error_message[ERROR_LINE_MAX + 1] = "";
154
155 - debug(
156 - D_EXPORTING,
157 - "EXPORTING: kinesis_put_record(): dest = %s, id = %s, key = %s, stream = %s, partition_key = %s, \
158 - buffer = %zu, record = %zu",
159 - instance->config.destination,
160 - connector_specific_config->auth_key_id,
161 - connector_specific_config->secure_key,
162 - connector_specific_config->stream_name,
163 - partition_key,
164 - buffer_len,
165 - record_len);
155 + netdata_log_debug(D_EXPORTING,
156 + "EXPORTING: kinesis_put_record(): dest = %s, id = %s, key = %s, stream = %s, partition_key = %s, \ "
157 + " buffer = %zu, record = %zu",
158 + instance->config.destination,
159 + connector_specific_config->auth_key_id,
160 + connector_specific_config->secure_key,
161 + connector_specific_config->stream_name,
162 + partition_key,
163 + buffer_len,
164 + record_len);
165
166 kinesis_put_record(
167 connector_specific_data, connector_specific_config->stream_name, partition_key, first_char, record_len);
exporting/check_filters.c
+3 -3
@@ -69,18 +69,18 @@ int rrdset_is_exportable(struct instance *instance, RRDSET *st)
69 *flags |= RRDSET_FLAG_EXPORTING_SEND;
70 else {
71 *flags |= RRDSET_FLAG_EXPORTING_IGNORE;
72 - debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s', because it is disabled for exporting.", rrdset_id(st), rrdhost_hostname(host));
72 + netdata_log_debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s', because it is disabled for exporting.", rrdset_id(st), rrdhost_hostname(host));
73 return 0;
74 }
75 }
76
77 if(unlikely(!rrdset_is_available_for_exporting_and_alarms(st))) {
78 - debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s', because it is not available for exporting.", rrdset_id(st), rrdhost_hostname(host));
78 + netdata_log_debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s', because it is not available for exporting.", rrdset_id(st), rrdhost_hostname(host));
79 return 0;
80 }
81
82 if(unlikely(st->rrd_memory_mode == RRD_MEMORY_MODE_NONE && !(EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AS_COLLECTED))) {
83 - debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s' because its memory mode is '%s' and the exporting engine requires database access.", rrdset_id(st), rrdhost_hostname(host), rrd_memory_mode_name(host->rrd_memory_mode));
83 + netdata_log_debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s' because its memory mode is '%s' and the exporting engine requires database access.", rrdset_id(st), rrdhost_hostname(host), rrd_memory_mode_name(host->rrd_memory_mode));
84 return 0;
85 }
86
exporting/mongodb/mongodb.c
+1 -1
@@ -329,7 +329,7 @@ void mongodb_connector_worker(void *instance_p)
329 data_size += insert[i]->len;
330 }
331
332 - debug(
332 + netdata_log_debug(
333 D_EXPORTING,
334 "EXPORTING: mongodb_insert(): destination = %s, database = %s, collection = %s, data size = %zu",
335 instance->config.destination,
exporting/process_data.c
+2 -2
@@ -107,7 +107,7 @@ NETDATA_DOUBLE exporting_calculate_value_from_stored_data(
107
108 if (unlikely(before < first_t || after > last_t)) {
109 // the chart has not been updated in the wanted timeframe
110 - debug(
110 + netdata_log_debug(
111 D_EXPORTING,
112 "EXPORTING: %s.%s.%s: aligned timeframe %lu to %lu is outside the chart's database range %lu to %lu",
113 rrdhost_hostname(host),
@@ -142,7 +142,7 @@ NETDATA_DOUBLE exporting_calculate_value_from_stored_data(
142 global_statistics_exporters_query_completed(points_read);
143
144 if (unlikely(!counter)) {
145 - debug(
145 + netdata_log_debug(
146 D_EXPORTING,
147 "EXPORTING: %s.%s.%s: no values stored in database for range %lu to %lu",
148 rrdhost_hostname(host),
exporting/prometheus/prometheus.c
+3 -3
@@ -41,7 +41,7 @@ inline int can_send_rrdset(struct instance *instance, RRDSET *st, SIMPLE_PATTERN
41 rrdset_flag_set(st, RRDSET_FLAG_EXPORTING_SEND);
42 } else {
43 rrdset_flag_set(st, RRDSET_FLAG_EXPORTING_IGNORE);
44 - debug(
44 + netdata_log_debug(
45 D_EXPORTING,
46 "EXPORTING: not sending chart '%s' of host '%s', because it is disabled for exporting.",
47 rrdset_id(st),
@@ -51,7 +51,7 @@ inline int can_send_rrdset(struct instance *instance, RRDSET *st, SIMPLE_PATTERN
51 }
52
53 if (unlikely(!rrdset_is_available_for_exporting_and_alarms(st))) {
54 - debug(
54 + netdata_log_debug(
55 D_EXPORTING,
56 "EXPORTING: not sending chart '%s' of host '%s', because it is not available for exporting.",
57 rrdset_id(st),
@@ -62,7 +62,7 @@ inline int can_send_rrdset(struct instance *instance, RRDSET *st, SIMPLE_PATTERN
62 if (unlikely(
63 st->rrd_memory_mode == RRD_MEMORY_MODE_NONE &&
64 !(EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AS_COLLECTED))) {
65 - debug(
65 + netdata_log_debug(
66 D_EXPORTING,
67 "EXPORTING: not sending chart '%s' of host '%s' because its memory mode is '%s' and the exporting connector requires database access.",
68 rrdset_id(st),
exporting/prometheus/remote_write/remote_write.c
+1 -1
@@ -244,7 +244,7 @@ int format_dimension_prometheus_remote_write(struct instance *instance, RRDDIM *
244 // we need as-collected / raw data
245
246 if (unlikely(rd->collector.last_collected_time.tv_sec < instance->after)) {
247 - debug(
247 + netdata_log_debug(
248 D_EXPORTING,
249 "EXPORTING: not sending dimension '%s' of chart '%s' from host '%s', "
250 "its last data collection (%lu) is not within our timeframe (%lu to %lu)",
exporting/pubsub/pubsub.c
+1 -1
@@ -141,7 +141,7 @@ void pubsub_connector_worker(void *instance_p)
141 goto cleanup;
142 }
143
144 - debug(
144 + netdata_log_debug(
145 D_EXPORTING, "EXPORTING: pubsub_publish(): project = %s, topic = %s, buffer = %zu",
146 connector_specific_config->project_id, connector_specific_config->topic_id, buffer_len);
147
exporting/send_data.c
+5 -6
@@ -40,12 +40,11 @@ int exporting_discard_response(BUFFER *buffer, struct instance *instance) {
40 }
41 *d = '\0';
42
43 - debug(
44 - D_EXPORTING,
45 - "EXPORTING: received %zu bytes from %s connector instance. Ignoring them. Sample: '%s'",
46 - buffer_strlen(buffer),
47 - instance->config.name,
48 - sample);
43 + netdata_log_debug(D_EXPORTING,
44 + "EXPORTING: received %zu bytes from %s connector instance. Ignoring them. Sample: '%s'",
45 + buffer_strlen(buffer),
46 + instance->config.name,
47 + sample);
48 #else
49 UNUSED(instance);
50 #endif /* NETDATA_INTERNAL_CHECKS */
health/health.c
+34 -34
@@ -312,10 +312,10 @@ static void health_silencers_init(void) {
312 * Initialize the health thread.
313 */
314 void health_init(void) {
315 - debug(D_HEALTH, "Health configuration initializing");
315 + netdata_log_debug(D_HEALTH, "Health configuration initializing");
316
317 if(!(default_health_enabled = (unsigned int)config_get_boolean(CONFIG_SECTION_HEALTH, "enabled", default_health_enabled))) {
318 - debug(D_HEALTH, "Health is disabled.");
318 + netdata_log_debug(D_HEALTH, "Health is disabled.");
319 return;
320 }
321
@@ -427,13 +427,13 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
427
428 if(unlikely(ae->new_status < RRDCALC_STATUS_CLEAR)) {
429 // do not send notifications for internal statuses
430 - debug(D_HEALTH, "Health not sending notification for alarm '%s.%s' status %s (internal statuses)", ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
430 + netdata_log_debug(D_HEALTH, "Health not sending notification for alarm '%s.%s' status %s (internal statuses)", ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
431 goto done;
432 }
433
434 if(unlikely(ae->new_status <= RRDCALC_STATUS_CLEAR && (ae->flags & HEALTH_ENTRY_FLAG_NO_CLEAR_NOTIFICATION))) {
435 // do not send notifications for disabled statuses
436 - debug(D_HEALTH, "Health not sending notification for alarm '%s.%s' status %s (it has no-clear-notification enabled)", ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
436 + netdata_log_debug(D_HEALTH, "Health not sending notification for alarm '%s.%s' status %s (it has no-clear-notification enabled)", ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
437 log_health("[%s]: Health not sending notification for alarm '%s.%s' status %s (it has no-clear-notification enabled)", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
438 // mark it as run, so that we will send the same alarm if it happens again
439 goto done;
@@ -450,7 +450,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
450 // we have executed this alarm notification in the past
451 if(last_executed_status == ae->new_status && !(ae->flags & HEALTH_ENTRY_FLAG_IS_REPEATING)) {
452 // don't send the notification for the same status again
453 - debug(D_HEALTH, "Health not sending again notification for alarm '%s.%s' status %s", ae_chart_name(ae), ae_name(ae)
453 + netdata_log_debug(D_HEALTH, "Health not sending again notification for alarm '%s.%s' status %s", ae_chart_name(ae), ae_name(ae)
454 , rrdcalc_status2string(ae->new_status));
455 log_health("[%s]: Health not sending again notification for alarm '%s.%s' status %s", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae)
456 , rrdcalc_status2string(ae->new_status));
@@ -462,7 +462,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
462 // so, don't send CLEAR notifications
463 if(unlikely(ae->new_status == RRDCALC_STATUS_CLEAR)) {
464 if((!(ae->flags & HEALTH_ENTRY_RUN_ONCE)) || (ae->flags & HEALTH_ENTRY_RUN_ONCE && ae->old_status < RRDCALC_STATUS_RAISED) ) {
465 - debug(D_HEALTH, "Health not sending notification for first initialization of alarm '%s.%s' status %s"
465 + netdata_log_debug(D_HEALTH, "Health not sending notification for first initialization of alarm '%s.%s' status %s"
466 , ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
467 goto done;
468 }
@@ -583,7 +583,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
583 ae->flags |= HEALTH_ENTRY_FLAG_EXEC_RUN;
584 ae->exec_run_timestamp = now_realtime_sec(); /* will be updated by real time after spawning */
585
586 - debug(D_HEALTH, "executing command '%s'", command_to_run);
586 + netdata_log_debug(D_HEALTH, "executing command '%s'", command_to_run);
587 ae->flags |= HEALTH_ENTRY_FLAG_EXEC_IN_PROGRESS;
588 ae->exec_spawn_serial = spawn_enq_cmd(command_to_run);
589 enqueue_alarm_notify_in_progress(ae);
@@ -608,7 +608,7 @@ static inline void health_alarm_wait_for_execution(ALARM_ENTRY *ae) {
608 return;
609
610 spawn_wait_cmd(ae->exec_spawn_serial, &ae->exec_code, &ae->exec_run_timestamp);
611 - debug(D_HEALTH, "done executing command - returned with code %d", ae->exec_code);
611 + netdata_log_debug(D_HEALTH, "done executing command - returned with code %d", ae->exec_code);
612 ae->flags &= ~HEALTH_ENTRY_FLAG_EXEC_IN_PROGRESS;
613
614 if(ae->exec_code != 0)
@@ -618,7 +618,7 @@ static inline void health_alarm_wait_for_execution(ALARM_ENTRY *ae) {
618 }
619
620 static inline void health_process_notifications(RRDHOST *host, ALARM_ENTRY *ae) {
621 - debug(D_HEALTH, "Health alarm '%s.%s' = " NETDATA_DOUBLE_FORMAT_AUTO " - changed status from %s to %s",
621 + netdata_log_debug(D_HEALTH, "Health alarm '%s.%s' = " NETDATA_DOUBLE_FORMAT_AUTO " - changed status from %s to %s",
622 ae->chart?ae_chart_name(ae):"NOCHART", ae_name(ae),
623 ae->new_value,
624 rrdcalc_status2string(ae->old_status),
@@ -691,7 +691,7 @@ static inline void health_alarm_log_process(RRDHOST *host) {
691
692 static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run) {
693 if(unlikely(!rc->rrdset)) {
694 - debug(D_HEALTH, "Health not running alarm '%s.%s'. It is not linked to a chart.", rrdcalc_chart_name(rc), rrdcalc_name(rc));
694 + netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. It is not linked to a chart.", rrdcalc_chart_name(rc), rrdcalc_name(rc));
695 return 0;
696 }
697
@@ -702,27 +702,27 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run)
702 *next_run = rc->next_update;
703 }
704
705 - debug(D_HEALTH, "Health not examining alarm '%s.%s' yet (will do in %d secs).", rrdcalc_chart_name(rc), rrdcalc_name(rc), (int) (rc->next_update - now));
705 + netdata_log_debug(D_HEALTH, "Health not examining alarm '%s.%s' yet (will do in %d secs).", rrdcalc_chart_name(rc), rrdcalc_name(rc), (int) (rc->next_update - now));
706 return 0;
707 }
708
709 if(unlikely(!rc->update_every)) {
710 - debug(D_HEALTH, "Health not running alarm '%s.%s'. It does not have an update frequency", rrdcalc_chart_name(rc), rrdcalc_name(rc));
710 + netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. It does not have an update frequency", rrdcalc_chart_name(rc), rrdcalc_name(rc));
711 return 0;
712 }
713
714 if(unlikely(rrdset_flag_check(rc->rrdset, RRDSET_FLAG_OBSOLETE))) {
715 - debug(D_HEALTH, "Health not running alarm '%s.%s'. The chart has been marked as obsolete", rrdcalc_chart_name(rc), rrdcalc_name(rc));
715 + netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. The chart has been marked as obsolete", rrdcalc_chart_name(rc), rrdcalc_name(rc));
716 return 0;
717 }
718
719 if(unlikely(rrdset_flag_check(rc->rrdset, RRDSET_FLAG_ARCHIVED))) {
720 - debug(D_HEALTH, "Health not running alarm '%s.%s'. The chart has been marked as archived", rrdcalc_chart_name(rc), rrdcalc_name(rc));
720 + netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. The chart has been marked as archived", rrdcalc_chart_name(rc), rrdcalc_name(rc));
721 return 0;
722 }
723
724 if(unlikely(!rc->rrdset->last_collected_time.tv_sec || rc->rrdset->counter_done < 2)) {
725 - debug(D_HEALTH, "Health not running alarm '%s.%s'. Chart is not fully collected yet.", rrdcalc_chart_name(rc), rrdcalc_name(rc));
725 + netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. Chart is not fully collected yet.", rrdcalc_chart_name(rc), rrdcalc_name(rc));
726 return 0;
727 }
728
@@ -731,7 +731,7 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run)
731 time_t last = rrdset_last_entry_s(rc->rrdset);
732
733 if(unlikely(now + update_every < first /* || now - update_every > last */)) {
734 - debug(D_HEALTH
734 + netdata_log_debug(D_HEALTH
735 , "Health not examining alarm '%s.%s' yet (wanted time is out of bounds - we need %lu but got %lu - %lu)."
736 , rrdcalc_chart_name(rc), rrdcalc_name(rc), (unsigned long) now, (unsigned long) first
737 , (unsigned long) last);
@@ -742,7 +742,7 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run)
742 time_t needed = now + rc->before + rc->after;
743
744 if(needed + update_every < first || needed - update_every > last) {
745 - debug(D_HEALTH
745 + netdata_log_debug(D_HEALTH
746 , "Health not examining alarm '%s.%s' yet (not enough data yet - we need %lu but got %lu - %lu)."
747 , rrdcalc_chart_name(rc), rrdcalc_name(rc), (unsigned long) needed, (unsigned long) first
748 , (unsigned long) last);
@@ -851,20 +851,20 @@ static void health_sleep(time_t next_run, unsigned int loop __maybe_unused) {
851 time_t now = now_realtime_sec();
852 if(now < next_run) {
853 worker_is_idle();
854 - debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration in %d secs", loop, (int) (next_run - now));
854 + netdata_log_debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration in %d secs", loop, (int) (next_run - now));
855 while (now < next_run && service_running(SERVICE_HEALTH)) {
856 sleep_usec(USEC_PER_SEC);
857 now = now_realtime_sec();
858 }
859 }
860 else {
861 - debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration now", loop);
861 + netdata_log_debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration now", loop);
862 }
863 }
864
865 static SILENCE_TYPE check_silenced(RRDCALC *rc, const char *host, SILENCERS *silencers) {
866 SILENCER *s;
867 - debug(D_HEALTH, "Checking if alarm was silenced via the command API. Alarm info name:%s context:%s chart:%s host:%s family:%s",
867 + netdata_log_debug(D_HEALTH, "Checking if alarm was silenced via the command API. Alarm info name:%s context:%s chart:%s host:%s family:%s",
868 rrdcalc_name(rc), (rc->rrdset)?rrdset_context(rc->rrdset):"", rrdcalc_chart_name(rc), host, (rc->rrdset)?rrdset_family(rc->rrdset):"");
869
870 for (s = silencers->silencers; s!=NULL; s=s->next){
@@ -875,11 +875,11 @@ static SILENCE_TYPE check_silenced(RRDCALC *rc, const char *host, SILENCERS *sil
875 (!s->charts_pattern || (rc->chart && s->charts_pattern && simple_pattern_matches_string(s->charts_pattern, rc->chart))) &&
876 (!s->families_pattern || (rc->rrdset && rc->rrdset->family && s->families_pattern && simple_pattern_matches_string(s->families_pattern, rc->rrdset->family)))
877 ) {
878 - debug(D_HEALTH, "Alarm matches command API silence entry %s:%s:%s:%s:%s", s->alarms,s->charts, s->contexts, s->hosts, s->families);
878 + netdata_log_debug(D_HEALTH, "Alarm matches command API silence entry %s:%s:%s:%s:%s", s->alarms,s->charts, s->contexts, s->hosts, s->families);
879 if (unlikely(silencers->stype == STYPE_NONE)) {
880 - debug(D_HEALTH, "Alarm %s matched a silence entry, but no SILENCE or DISABLE command was issued via the command API. The match has no effect.", rrdcalc_name(rc));
880 + netdata_log_debug(D_HEALTH, "Alarm %s matched a silence entry, but no SILENCE or DISABLE command was issued via the command API. The match has no effect.", rrdcalc_name(rc));
881 } else {
882 - debug(D_HEALTH, "Alarm %s via the command API - name:%s context:%s chart:%s host:%s family:%s"
882 + netdata_log_debug(D_HEALTH, "Alarm %s via the command API - name:%s context:%s chart:%s host:%s family:%s"
883 , (silencers->stype == STYPE_DISABLE_ALARMS)?"Disabled":"Silenced"
884 , rrdcalc_name(rc)
885 , (rc->rrdset)?rrdset_context(rc->rrdset):""
@@ -1031,7 +1031,7 @@ void *health_main(void *ptr) {
1031
1032 while(service_running(SERVICE_HEALTH)) {
1033 loop++;
1034 - debug(D_HEALTH, "Health monitoring iteration no %u started", loop);
1034 + netdata_log_debug(D_HEALTH, "Health monitoring iteration no %u started", loop);
1035
1036 time_t now = now_realtime_sec();
1037 int runnable = 0, apply_hibernation_delay = 0;
@@ -1202,7 +1202,7 @@ void *health_main(void *ptr) {
1202 rc->value = NAN;
1203 rc->run_flags |= RRDCALC_FLAG_DB_ERROR;
1204
1205 - debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup returned error %d",
1205 + netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup returned error %d",
1206 rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc), ret
1207 );
1208 } else
@@ -1213,14 +1213,14 @@ void *health_main(void *ptr) {
1213 rc->value = NAN;
1214 rc->run_flags |= RRDCALC_FLAG_DB_NAN;
1215
1216 - debug(D_HEALTH,
1216 + netdata_log_debug(D_HEALTH,
1217 "Health on host '%s', alarm '%s.%s': database lookup returned empty value (possibly value is not collected yet)",
1218 rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc)
1219 );
1220 } else
1221 rc->run_flags &= ~RRDCALC_FLAG_DB_NAN;
1222
1223 - debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup gave value " NETDATA_DOUBLE_FORMAT,
1223 + netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup gave value " NETDATA_DOUBLE_FORMAT,
1224 rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc), rc->value
1225 );
1226 }
@@ -1236,14 +1236,14 @@ void *health_main(void *ptr) {
1236 rc->value = NAN;
1237 rc->run_flags |= RRDCALC_FLAG_CALC_ERROR;
1238
1239 - debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' failed: %s",
1239 + netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' failed: %s",
1240 rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc),
1241 rc->calculation->parsed_as, buffer_tostring(rc->calculation->error_msg)
1242 );
1243 } else {
1244 rc->run_flags &= ~RRDCALC_FLAG_CALC_ERROR;
1245
1246 - debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' gave value "
1246 + netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' gave value "
1247 NETDATA_DOUBLE_FORMAT
1248 ": %s (source: %s)", rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc),
1249 rc->calculation->parsed_as, rc->calculation->result,
@@ -1280,14 +1280,14 @@ void *health_main(void *ptr) {
1280 // calculation failed
1281 rc->run_flags |= RRDCALC_FLAG_WARN_ERROR;
1282
1283 - debug(D_HEALTH,
1283 + netdata_log_debug(D_HEALTH,
1284 "Health on host '%s', alarm '%s.%s': warning expression failed with error: %s",
1285 rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc),
1286 buffer_tostring(rc->warning->error_msg)
1287 );
1288 } else {
1289 rc->run_flags &= ~RRDCALC_FLAG_WARN_ERROR;
1290 - debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': warning expression gave value "
1290 + netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': warning expression gave value "
1291 NETDATA_DOUBLE_FORMAT
1292 ": %s (source: %s)", rrdhost_hostname(host), rrdcalc_chart_name(rc),
1293 rrdcalc_name(rc), rc->warning->result, buffer_tostring(rc->warning->error_msg), rrdcalc_source(rc)
@@ -1306,14 +1306,14 @@ void *health_main(void *ptr) {
1306 // calculation failed
1307 rc->run_flags |= RRDCALC_FLAG_CRIT_ERROR;
1308
1309 - debug(D_HEALTH,
1309 + netdata_log_debug(D_HEALTH,
1310 "Health on host '%s', alarm '%s.%s': critical expression failed with error: %s",
1311 rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc),
1312 buffer_tostring(rc->critical->error_msg)
1313 );
1314 } else {
1315 rc->run_flags &= ~RRDCALC_FLAG_CRIT_ERROR;
1316 - debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': critical expression gave value "
1316 + netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': critical expression gave value "
1317 NETDATA_DOUBLE_FORMAT
1318 ": %s (source: %s)", rrdhost_hostname(host), rrdcalc_chart_name(rc),
1319 rrdcalc_name(rc), rc->critical->result, buffer_tostring(rc->critical->error_msg),
@@ -1515,7 +1515,7 @@ void *health_main(void *ptr) {
1515 }
1516 rc->run_flags |= RRDCALC_FLAG_RUN_ONCE;
1517 health_process_notifications(host, ae);
1518 - debug(D_HEALTH, "Notification sent for the repeating alarm %u.", ae->alarm_id);
1518 + netdata_log_debug(D_HEALTH, "Notification sent for the repeating alarm %u.", ae->alarm_id);
1519 health_alarm_wait_for_execution(ae);
1520 health_alarm_log_free_one_nochecks_nounlink(ae);
1521 }
health/health_config.c
+7 -7
@@ -308,7 +308,7 @@ static inline int health_parse_db_lookup(
308 RRDR_TIME_GROUPING *group_method, int *after, int *before, int *every,
309 RRDCALC_OPTIONS *options, STRING **dimensions, STRING **foreachdim
310 ) {
311 - debug(D_HEALTH, "Health configuration parsing database lookup %zu@%s: %s", line, filename, string);
311 + netdata_log_debug(D_HEALTH, "Health configuration parsing database lookup %zu@%s: %s", line, filename, string);
312
313 if(*dimensions) string_freez(*dimensions);
314 if(*foreachdim) string_freez(*foreachdim);
@@ -507,7 +507,7 @@ int sql_store_hashes = 1;
507 static int health_readfile(const char *filename, void *data) {
508 RRDHOST *host = (RRDHOST *)data;
509
510 - debug(D_HEALTH, "Health configuration reading file '%s'", filename);
510 + netdata_log_debug(D_HEALTH, "Health configuration reading file '%s'", filename);
511
512 static uint32_t
513 hash_alarm = 0,
@@ -738,10 +738,10 @@ static int health_readfile(const char *filename, void *data) {
738
739 if(!simple_pattern_matches_string(os_pattern, host->os)) {
740 if(rc)
741 - debug(D_HEALTH, "HEALTH on '%s' ignoring alarm '%s' defined at %zu@%s: host O/S does not match '%s'", rrdhost_hostname(host), rrdcalc_name(rc), line, filename, os_match);
741 + netdata_log_debug(D_HEALTH, "HEALTH on '%s' ignoring alarm '%s' defined at %zu@%s: host O/S does not match '%s'", rrdhost_hostname(host), rrdcalc_name(rc), line, filename, os_match);
742
743 if(rt)
744 - debug(D_HEALTH, "HEALTH on '%s' ignoring template '%s' defined at %zu@%s: host O/S does not match '%s'", rrdhost_hostname(host), rrdcalctemplate_name(rt), line, filename, os_match);
744 + netdata_log_debug(D_HEALTH, "HEALTH on '%s' ignoring template '%s' defined at %zu@%s: host O/S does not match '%s'", rrdhost_hostname(host), rrdcalctemplate_name(rt), line, filename, os_match);
745
746 ignore_this = 1;
747 }
@@ -755,10 +755,10 @@ static int health_readfile(const char *filename, void *data) {
755
756 if(!simple_pattern_matches_string(host_pattern, host->hostname)) {
757 if(rc)
758 - debug(D_HEALTH, "HEALTH on '%s' ignoring alarm '%s' defined at %zu@%s: hostname does not match '%s'", rrdhost_hostname(host), rrdcalc_name(rc), line, filename, host_match);
758 + netdata_log_debug(D_HEALTH, "HEALTH on '%s' ignoring alarm '%s' defined at %zu@%s: hostname does not match '%s'", rrdhost_hostname(host), rrdcalc_name(rc), line, filename, host_match);
759
760 if(rt)
761 - debug(D_HEALTH, "HEALTH on '%s' ignoring template '%s' defined at %zu@%s: hostname does not match '%s'", rrdhost_hostname(host), rrdcalctemplate_name(rt), line, filename, host_match);
761 + netdata_log_debug(D_HEALTH, "HEALTH on '%s' ignoring template '%s' defined at %zu@%s: hostname does not match '%s'", rrdhost_hostname(host), rrdcalctemplate_name(rt), line, filename, host_match);
762
763 ignore_this = 1;
764 }
@@ -1328,7 +1328,7 @@ void sql_refresh_hashes(void)
1328 void health_readdir(RRDHOST *host, const char *user_path, const char *stock_path, const char *subpath) {
1329 if(unlikely((!host->health.health_enabled) && !rrdhost_flag_check(host, RRDHOST_FLAG_INITIALIZED_HEALTH)) ||
1330 !service_running(SERVICE_HEALTH)) {
1331 - debug(D_HEALTH, "CONFIG health is not enabled for host '%s'", rrdhost_hostname(host));
1331 + netdata_log_debug(D_HEALTH, "CONFIG health is not enabled for host '%s'", rrdhost_hostname(host));
1332 return;
1333 }
1334
health/health_log.c
+2 -2
@@ -37,7 +37,7 @@ inline ALARM_ENTRY* health_create_alarm_entry(
37 int delay,
38 HEALTH_ENTRY_FLAGS flags
39 ) {
40 - debug(D_HEALTH, "Health adding alarm log entry with id: %u", host->health_log.next_log_id);
40 + netdata_log_debug(D_HEALTH, "Health adding alarm log entry with id: %u", host->health_log.next_log_id);
41
42 ALARM_ENTRY *ae = callocz(1, sizeof(ALARM_ENTRY));
43 ae->name = string_dup(name);
@@ -89,7 +89,7 @@ inline void health_alarm_log_add_entry(
89 RRDHOST *host,
90 ALARM_ENTRY *ae
91 ) {
92 - debug(D_HEALTH, "Health adding alarm log entry with id: %u", ae->unique_id);
92 + netdata_log_debug(D_HEALTH, "Health adding alarm log entry with id: %u", ae->unique_id);
93
94 __atomic_add_fetch(&host->health_transitions, 1, __ATOMIC_RELAXED);
95
libnetdata/buffer/buffer.c
+5 -5
@@ -107,7 +107,7 @@ void buffer_vsprintf(BUFFER *wb, const char *fmt, va_list args)
107 do {
108 need += space_remaining * 2;
109
110 - debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote);
110 + netdata_log_debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote);
111 buffer_need_bytes(wb, need);
112
113 space_remaining = wb->size - wb->len - 1;
@@ -131,7 +131,7 @@ void buffer_sprintf(BUFFER *wb, const char *fmt, ...)
131 do {
132 need += space_remaining * 2;
133
134 - debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote);
134 + netdata_log_debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote);
135 buffer_need_bytes(wb, need);
136
137 space_remaining = wb->size - wb->len - 1;
@@ -246,7 +246,7 @@ BUFFER *buffer_create(size_t size, size_t *statistics)
246 {
247 BUFFER *b;
248
249 - debug(D_WEB_BUFFER, "Creating new web buffer of size %zu.", size);
249 + netdata_log_debug(D_WEB_BUFFER, "Creating new web buffer of size %zu.", size);
250
251 b = callocz(1, sizeof(BUFFER));
252 b->buffer = mallocz(size + sizeof(BUFFER_OVERFLOW_EOF) + 2);
@@ -268,7 +268,7 @@ void buffer_free(BUFFER *b) {
268
269 buffer_overflow_check(b);
270
271 - debug(D_WEB_BUFFER, "Freeing web buffer of size %zu.", b->size);
271 + netdata_log_debug(D_WEB_BUFFER, "Freeing web buffer of size %zu.", b->size);
272
273 if(b->statistics)
274 __atomic_sub_fetch(b->statistics, b->size + sizeof(BUFFER) + sizeof(BUFFER_OVERFLOW_EOF) + 2, __ATOMIC_RELAXED);
@@ -290,7 +290,7 @@ void buffer_increase(BUFFER *b, size_t free_size_required) {
290 size_t optimal = (b->size > 5*1024*1024) ? b->size / 2 : b->size;
291 if(optimal > wanted) wanted = optimal;
292
293 - debug(D_WEB_BUFFER, "Increasing data buffer from size %zu to %zu.", b->size, b->size + wanted);
293 + netdata_log_debug(D_WEB_BUFFER, "Increasing data buffer from size %zu to %zu.", b->size, b->size + wanted);
294
295 b->buffer = reallocz(b->buffer, b->size + wanted + sizeof(BUFFER_OVERFLOW_EOF) + 2);
296 b->size += wanted;
libnetdata/config/appconfig.c
+14 -14
@@ -164,7 +164,7 @@ static inline struct section *appconfig_section_find(struct config *root, const
164 }
165
166 static inline struct section *appconfig_section_create(struct config *root, const char *section) {
167 - debug(D_CONFIG, "Creating section '%s'.", section);
167 + netdata_log_debug(D_CONFIG, "Creating section '%s'.", section);
168
169 struct section *co = callocz(1, sizeof(struct section));
170 co->name = strdupz(section);
@@ -194,7 +194,7 @@ void appconfig_section_destroy_non_loaded(struct config *root, const char *secti
194 struct section *co;
195 struct config_option *cv, *cv_next;
196
197 - debug(D_CONFIG, "Destroying section '%s'.", section);
197 + netdata_log_debug(D_CONFIG, "Destroying section '%s'.", section);
198
199 co = appconfig_section_find(root, section);
200 if(!co) {
@@ -259,7 +259,7 @@ void appconfig_section_destroy_non_loaded(struct config *root, const char *secti
259
260 void appconfig_section_option_destroy_non_loaded(struct config *root, const char *section, const char *name)
261 {
262 - debug(D_CONFIG, "Destroying section option '%s -> %s'.", section, name);
262 + netdata_log_debug(D_CONFIG, "Destroying section option '%s -> %s'.", section, name);
263
264 struct section *co;
265 co = appconfig_section_find(root, section);
@@ -310,7 +310,7 @@ void appconfig_section_option_destroy_non_loaded(struct config *root, const char
310 // config name-value methods
311
312 static inline struct config_option *appconfig_value_create(struct section *co, const char *name, const char *value) {
313 - debug(D_CONFIG, "Creating config entry for name '%s', value '%s', in section '%s'.", name, value, co->name);
313 + netdata_log_debug(D_CONFIG, "Creating config entry for name '%s', value '%s', in section '%s'.", name, value, co->name);
314
315 struct config_option *cv = callocz(1, sizeof(struct config_option));
316 cv->name = strdupz(name);
@@ -341,7 +341,7 @@ static inline struct config_option *appconfig_value_create(struct section *co, c
341 int appconfig_exists(struct config *root, const char *section, const char *name) {
342 struct config_option *cv;
343
344 - debug(D_CONFIG, "request to get config in section '%s', name '%s'", section, name);
344 + netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s'", section, name);
345
346 struct section *co = appconfig_section_find(root, section);
347 if(!co) return 0;
@@ -356,7 +356,7 @@ int appconfig_move(struct config *root, const char *section_old, const char *nam
356 struct config_option *cv_old, *cv_new;
357 int ret = -1;
358
359 - debug(D_CONFIG, "request to rename config in section '%s', old name '%s', to section '%s', new name '%s'", section_old, name_old, section_new, name_new);
359 + netdata_log_debug(D_CONFIG, "request to rename config in section '%s', old name '%s', to section '%s', new name '%s'", section_old, name_old, section_new, name_new);
360
361 struct section *co_old = appconfig_section_find(root, section_old);
362 if(!co_old) return ret;
@@ -439,9 +439,9 @@ char *appconfig_get_by_section(struct section *co, const char *name, const char
439 char *appconfig_get(struct config *root, const char *section, const char *name, const char *default_value)
440 {
441 if (default_value == NULL)
442 - debug(D_CONFIG, "request to get config in section '%s', name '%s' or fail", section, name);
442 + netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s' or fail", section, name);
443 else
444 - debug(D_CONFIG, "request to get config in section '%s', name '%s', default_value '%s'", section, name, default_value);
444 + netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s', default_value '%s'", section, name, default_value);
445
446 struct section *co = appconfig_section_find(root, section);
447 if (!co && !default_value)
@@ -532,7 +532,7 @@ const char *appconfig_set_default(struct config *root, const char *section, cons
532 {
533 struct config_option *cv;
534
535 - debug(D_CONFIG, "request to set default config in section '%s', name '%s', value '%s'", section, name, value);
535 + netdata_log_debug(D_CONFIG, "request to set default config in section '%s', name '%s', value '%s'", section, name, value);
536
537 struct section *co = appconfig_section_find(root, section);
538 if(!co) return appconfig_set(root, section, name, value);
@@ -559,7 +559,7 @@ const char *appconfig_set(struct config *root, const char *section, const char *
559 {
560 struct config_option *cv;
561
562 - debug(D_CONFIG, "request to set config in section '%s', name '%s', value '%s'", section, name, value);
562 + netdata_log_debug(D_CONFIG, "request to set config in section '%s', name '%s', value '%s'", section, name, value);
563
564 struct section *co = appconfig_section_find(root, section);
565 if(!co) co = appconfig_section_create(root, section);
@@ -649,7 +649,7 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons
649
650 if(!filename) filename = CONFIG_DIR "/" CONFIG_FILENAME;
651
652 - debug(D_CONFIG, "CONFIG: opening config file '%s'", filename);
652 + netdata_log_debug(D_CONFIG, "CONFIG: opening config file '%s'", filename);
653
654 FILE *fp = fopen(filename, "r");
655 if(!fp) {
@@ -669,7 +669,7 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons
669
670 s = trim(buffer);
671 if(!s || *s == '#') {
672 - debug(D_CONFIG, "CONFIG: ignoring line %d of file '%s', it is empty.", line, filename);
672 + netdata_log_debug(D_CONFIG, "CONFIG: ignoring line %d of file '%s', it is empty.", line, filename);
673 continue;
674 }
675
@@ -778,12 +778,12 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons
778 }
779 } else {
780 if (((cv->flags & CONFIG_VALUE_USED) && overwrite_used) || !(cv->flags & CONFIG_VALUE_USED)) {
781 - debug(
781 + netdata_log_debug(
782 D_CONFIG, "CONFIG: line %d of file '%s', overwriting '%s/%s'.", line, filename, co->name, cv->name);
783 freez(cv->value);
784 cv->value = strdupz(value);
785 } else
786 - debug(
786 + netdata_log_debug(
787 D_CONFIG,
788 "CONFIG: ignoring line %d of file '%s', '%s/%s' is already present and used.",
789 line,
libnetdata/dictionary/dictionary.c
+10 -10
@@ -1065,7 +1065,7 @@ static size_t hashtable_destroy_unsafe(DICTIONARY *dict) {
1065 JU_ERRNO(&J_Error), JU_ERRID(&J_Error));
1066 }
1067
1068 - debug(D_DICTIONARY, "Dictionary: hash table freed %lu bytes", ret);
1068 + netdata_log_debug(D_DICTIONARY, "Dictionary: hash table freed %lu bytes", ret);
1069
1070 dict->index.JudyHSArray = NULL;
1071 return (size_t)ret;
@@ -1376,7 +1376,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *
1376 if(unlikely(is_view_dictionary(dict)))
1377 fatal("DICTIONARY: %s() should never be called on views.", __FUNCTION__ );
1378
1379 - debug(D_DICTIONARY, "Dictionary entry with name '%s' found. Changing its value.", item_get_name(item));
1379 + netdata_log_debug(D_DICTIONARY, "Dictionary entry with name '%s' found. Changing its value.", item_get_name(item));
1380
1381 DICTIONARY_VALUE_RESETS_PLUS1(dict);
1382
@@ -1388,12 +1388,12 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *
1388 dictionary_execute_delete_callback(dict, item);
1389
1390 if(likely(dict->options & DICT_OPTION_VALUE_LINK_DONT_CLONE)) {
1391 - debug(D_DICTIONARY, "Dictionary: linking value to '%s'", item_get_name(item));
1391 + netdata_log_debug(D_DICTIONARY, "Dictionary: linking value to '%s'", item_get_name(item));
1392 item->shared->value = value;
1393 item->shared->value_len = value_len;
1394 }
1395 else {
1396 - debug(D_DICTIONARY, "Dictionary: cloning value to '%s'", item_get_name(item));
1396 + netdata_log_debug(D_DICTIONARY, "Dictionary: cloning value to '%s'", item_get_name(item));
1397
1398 void *old_value = item->shared->value;
1399 void *new_value = NULL;
@@ -1405,7 +1405,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *
1405 item->shared->value = new_value;
1406 item->shared->value_len = value_len;
1407
1408 - debug(D_DICTIONARY, "Dictionary: freeing old value of '%s'", item_get_name(item));
1408 + netdata_log_debug(D_DICTIONARY, "Dictionary: freeing old value of '%s'", item_get_name(item));
1409 dict_item_value_freez(dict, old_value);
1410 }
1411
@@ -1413,7 +1413,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *
1413 }
1414
1415 static size_t dict_item_free_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *item) {
1416 - debug(D_DICTIONARY, "Destroying name value entry for name '%s'.", item_get_name(item));
1416 + netdata_log_debug(D_DICTIONARY, "Destroying name value entry for name '%s'.", item_get_name(item));
1417
1418 if(!item_flag_check(item, ITEM_FLAG_DELETED))
1419 DICTIONARY_ENTRIES_MINUS1(dict);
@@ -1428,7 +1428,7 @@ static size_t dict_item_free_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *item)
1428 dictionary_execute_delete_callback(dict, item);
1429
1430 if(unlikely(!(dict->options & DICT_OPTION_VALUE_LINK_DONT_CLONE))) {
1431 - debug(D_DICTIONARY, "Dictionary freeing value of '%s'", item_get_name(item));
1431 + netdata_log_debug(D_DICTIONARY, "Dictionary freeing value of '%s'", item_get_name(item));
1432 dict_item_value_freez(dict, item->shared->value);
1433 item->shared->value = NULL;
1434 }
@@ -1554,7 +1554,7 @@ static bool dict_item_del(DICTIONARY *dict, const char *name, ssize_t name_len)
1554 if(name_len == -1)
1555 name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too
1556
1557 - debug(D_DICTIONARY, "DEL dictionary entry with name '%s'.", name);
1557 + netdata_log_debug(D_DICTIONARY, "DEL dictionary entry with name '%s'.", name);
1558
1559 // Unfortunately, the JudyHSDel() does not return the value of the
1560 // item that was deleted, so we have to find it before we delete it,
@@ -1605,7 +1605,7 @@ static DICTIONARY_ITEM *dict_item_add_or_reset_value_and_acquire(DICTIONARY *dic
1605 if(name_len == -1)
1606 name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too
1607
1608 - debug(D_DICTIONARY, "SET dictionary entry with name '%s'.", name);
1608 + netdata_log_debug(D_DICTIONARY, "SET dictionary entry with name '%s'.", name);
1609
1610 // DISCUSSION:
1611 // Is it better to gain a read-lock and do a hashtable_get_unsafe()
@@ -1724,7 +1724,7 @@ static DICTIONARY_ITEM *dict_item_find_and_acquire(DICTIONARY *dict, const char
1724 if(name_len == -1)
1725 name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too
1726
1727 - debug(D_DICTIONARY, "GET dictionary entry with name '%s'.", name);
1727 + netdata_log_debug(D_DICTIONARY, "GET dictionary entry with name '%s'.", name);
1728
1729 dictionary_index_lock_rdlock(dict);
1730
libnetdata/ebpf/ebpf.c
-1
@@ -44,7 +44,6 @@ static int clean_kprobe_event(FILE *out, char *filename, char *father_pid, netda
44
45 int clean_kprobe_events(FILE *out, int pid, netdata_ebpf_events_t *ptr)
46 {
47 - debug(D_EXIT, "Cleaning parent process events.");
47 char filename[FILENAME_MAX + 1];
48 snprintf(filename, FILENAME_MAX, "%s%s", NETDATA_DEBUGFS, "kprobe_events");
49
libnetdata/health/health.c
+6 -6
@@ -11,7 +11,7 @@ SILENCERS *silencers;
11 */
12 SILENCER *create_silencer(void) {
13 SILENCER *t = callocz(1, sizeof(SILENCER));
14 - debug(D_HEALTH, "HEALTH command API: Created empty silencer");
14 + netdata_log_debug(D_HEALTH, "HEALTH command API: Created empty silencer");
15
16 return t;
17 }
@@ -27,7 +27,7 @@ void health_silencers_add(SILENCER *silencer) {
27 // Add the created instance to the linked list in silencers
28 silencer->next = silencers->silencers;
29 silencers->silencers = silencer;
30 - debug(D_HEALTH, "HEALTH command API: Added silencer %s:%s:%s:%s:%s", silencer->alarms,
30 + netdata_log_debug(D_HEALTH, "HEALTH command API: Added silencer %s:%s:%s:%s:%s", silencer->alarms,
31 silencer->charts, silencer->contexts, silencer->hosts, silencer->families
32 );
33 }
@@ -116,7 +116,7 @@ int health_silencers_json_read_callback(JSON_ENTRY *e)
116 e->callback_function = health_silencers_json_read_callback;
117 if(strcmp(e->name,"")) {
118 // init silencer
119 - debug(D_HEALTH, "JSON: Got object with a name, initializing new silencer for %s",e->name);
119 + netdata_log_debug(D_HEALTH, "JSON: Got object with a name, initializing new silencer for %s",e->name);
120 #endif
121 e->callback_data = create_silencer();
122 if(e->callback_data) {
@@ -133,18 +133,18 @@ int health_silencers_json_read_callback(JSON_ENTRY *e)
133
134 case JSON_STRING:
135 if(!strcmp(e->name,"type")) {
136 - debug(D_HEALTH, "JSON: Processing type=%s",e->data.string);
136 + netdata_log_debug(D_HEALTH, "JSON: Processing type=%s",e->data.string);
137 if (!strcmp(e->data.string,"SILENCE")) silencers->stype = STYPE_SILENCE_NOTIFICATIONS;
138 else if (!strcmp(e->data.string,"DISABLE")) silencers->stype = STYPE_DISABLE_ALARMS;
139 } else {
140 - debug(D_HEALTH, "JSON: Adding %s=%s", e->name, e->data.string);
140 + netdata_log_debug(D_HEALTH, "JSON: Adding %s=%s", e->name, e->data.string);
141 if (e->callback_data)
142 (void)health_silencers_addparam(e->callback_data, e->name, e->data.string);
143 }
144 break;
145
146 case JSON_BOOLEAN:
147 - debug(D_HEALTH, "JSON: Processing all_alarms");
147 + netdata_log_debug(D_HEALTH, "JSON: Processing all_alarms");
148 silencers->all_alarms=e->data.boolean?1:0;
149 break;
150
libnetdata/libnetdata.c
+9 -9
@@ -1529,7 +1529,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
1529 char *udir = strdupz_path_subpath(user_path, subpath);
1530 char *sdir = strdupz_path_subpath(stock_path, subpath);
1531
1532 - debug(D_HEALTH, "CONFIG traversing user-config directory '%s', stock config directory '%s'", udir, sdir);
1532 + netdata_log_debug(D_HEALTH, "CONFIG traversing user-config directory '%s', stock config directory '%s'", udir, sdir);
1533
1534 DIR *dir = opendir(udir);
1535 if (!dir) {
@@ -1543,7 +1543,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
1543 (de->d_name[0] == '.' && de->d_name[1] == '\0') ||
1544 (de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0')
1545 ) {
1546 - debug(D_HEALTH, "CONFIG ignoring user-config directory '%s/%s'", udir, de->d_name);
1546 + netdata_log_debug(D_HEALTH, "CONFIG ignoring user-config directory '%s/%s'", udir, de->d_name);
1547 continue;
1548 }
1549
@@ -1558,20 +1558,20 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
1558 if(path_is_file(udir, de->d_name) &&
1559 len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) {
1560 char *filename = strdupz_path_subpath(udir, de->d_name);
1561 - debug(D_HEALTH, "CONFIG calling callback for user file '%s'", filename);
1561 + netdata_log_debug(D_HEALTH, "CONFIG calling callback for user file '%s'", filename);
1562 callback(filename, data);
1563 freez(filename);
1564 continue;
1565 }
1566 }
1567
1568 - debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type);
1568 + netdata_log_debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type);
1569 }
1570
1571 closedir(dir);
1572 }
1573
1574 - debug(D_HEALTH, "CONFIG traversing stock config directory '%s', user config directory '%s'", sdir, udir);
1574 + netdata_log_debug(D_HEALTH, "CONFIG traversing stock config directory '%s', user config directory '%s'", sdir, udir);
1575
1576 dir = opendir(sdir);
1577 if (!dir) {
@@ -1586,7 +1586,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
1586 (de->d_name[0] == '.' && de->d_name[1] == '\0') ||
1587 (de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0')
1588 ) {
1589 - debug(D_HEALTH, "CONFIG ignoring stock config directory '%s/%s'", sdir, de->d_name);
1589 + netdata_log_debug(D_HEALTH, "CONFIG ignoring stock config directory '%s/%s'", sdir, de->d_name);
1590 continue;
1591 }
1592
@@ -1606,7 +1606,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
1606 if(path_is_file(sdir, de->d_name) && !path_is_file(udir, de->d_name) &&
1607 len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) {
1608 char *filename = strdupz_path_subpath(sdir, de->d_name);
1609 - debug(D_HEALTH, "CONFIG calling callback for stock file '%s'", filename);
1609 + netdata_log_debug(D_HEALTH, "CONFIG calling callback for stock file '%s'", filename);
1610 callback(filename, data);
1611 freez(filename);
1612 continue;
@@ -1614,13 +1614,13 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
1614
1615 }
1616
1617 - debug(D_HEALTH, "CONFIG ignoring stock-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type);
1617 + netdata_log_debug(D_HEALTH, "CONFIG ignoring stock-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type);
1618 }
1619 }
1620 closedir(dir);
1621 }
1622
1623 - debug(D_HEALTH, "CONFIG done traversing user-config directory '%s', stock config directory '%s'", udir, sdir);
1623 + netdata_log_debug(D_HEALTH, "CONFIG done traversing user-config directory '%s', stock config directory '%s'", udir, sdir);
1624
1625 freez(udir);
1626 freez(sdir);
libnetdata/locks/locks.c
+10 -10
@@ -135,29 +135,29 @@ int __netdata_mutex_unlock(netdata_mutex_t *mutex) {
135
136 int netdata_mutex_init_debug(const char *file __maybe_unused, const char *function __maybe_unused,
137 const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
138 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) from %lu@%s, %s()", mutex, line, file, function);
138 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) from %lu@%s, %s()", mutex, line, file, function);
139
140 int ret = __netdata_mutex_init(mutex);
141
142 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function);
142 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function);
143
144 return ret;
145 }
146
147 int netdata_mutex_destroy_debug(const char *file __maybe_unused, const char *function __maybe_unused,
148 const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
149 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) from %lu@%s, %s()", mutex, line, file, function);
149 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) from %lu@%s, %s()", mutex, line, file, function);
150
151 int ret = __netdata_mutex_destroy(mutex);
152
153 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function);
153 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function);
154
155 return ret;
156 }
157
158 int netdata_mutex_lock_debug(const char *file __maybe_unused, const char *function __maybe_unused,
159 const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
160 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) from %lu@%s, %s()", mutex, line, file, function);
160 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) from %lu@%s, %s()", mutex, line, file, function);
161
162 usec_t start_s = now_monotonic_high_precision_usec();
163 int ret = __netdata_mutex_lock(mutex);
@@ -167,14 +167,14 @@ int netdata_mutex_lock_debug(const char *file __maybe_unused, const char *functi
167 (void)start_s;
168 (void)end_s;
169
170 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
170 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
171
172 return ret;
173 }
174
175 int netdata_mutex_trylock_debug(const char *file __maybe_unused, const char *function __maybe_unused,
176 const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
177 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) from %lu@%s, %s()", mutex, line, file, function);
177 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) from %lu@%s, %s()", mutex, line, file, function);
178
179 usec_t start_s = now_monotonic_high_precision_usec();
180 int ret = __netdata_mutex_trylock(mutex);
@@ -184,14 +184,14 @@ int netdata_mutex_trylock_debug(const char *file __maybe_unused, const char *fun
184 (void)start_s;
185 (void)end_s;
186
187 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
187 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
188
189 return ret;
190 }
191
192 int netdata_mutex_unlock_debug(const char *file __maybe_unused, const char *function __maybe_unused,
193 const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
194 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) from %lu@%s, %s()", mutex, line, file, function);
194 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) from %lu@%s, %s()", mutex, line, file, function);
195
196 usec_t start_s = now_monotonic_high_precision_usec();
197 int ret = __netdata_mutex_unlock(mutex);
@@ -201,7 +201,7 @@ int netdata_mutex_unlock_debug(const char *file __maybe_unused, const char *func
201 (void)start_s;
202 (void)end_s;
203
204 - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
204 + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
205
206 return ret;
207 }
libnetdata/log/log.h
+2 -2
@@ -109,11 +109,11 @@ typedef struct error_with_limit {
109 #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) }
110
111 #ifdef NETDATA_INTERNAL_CHECKS
112 -#define debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
112 +#define netdata_log_debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
113 #define internal_error(condition, args...) do { if(unlikely(condition)) error_int(0, "IERR", __FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
114 #define internal_fatal(condition, args...) do { if(unlikely(condition)) fatal_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
115 #else
116 -#define debug(type, args...) debug_dummy()
116 +#define netdata_log_debug(type, args...) debug_dummy()
117 #define internal_error(args...) debug_dummy()
118 #define internal_fatal(args...) debug_dummy()
119 #endif
libnetdata/os.c
+1 -1
@@ -75,7 +75,7 @@ long get_system_cpus_with_cache(bool cache, bool for_netdata) {
75 if(processors[index] < 1)
76 processors[index] = 1;
77
78 - debug(D_SYSTEM, "System has %ld processors.", processors[index]);
78 + netdata_log_debug(D_SYSTEM, "System has %ld processors.", processors[index]);
79 return processors[index];
80
81 #endif /* __APPLE__, __FreeBSD__ */
libnetdata/popen/popen.c
+1 -1
@@ -384,7 +384,7 @@ int netdata_pclose(FILE *fp_child_input, FILE *fp_child_output, pid_t pid) {
384 int ret;
385 siginfo_t info;
386
387 - debug(D_EXIT, "Request to netdata_pclose() on pid %d", pid);
387 + netdata_log_debug(D_EXIT, "Request to netdata_pclose() on pid %d", pid);
388
389 if (fp_child_input)
390 fclose(fp_child_input);
libnetdata/procfile/procfile.c
+23 -23
@@ -48,11 +48,11 @@ char *procfile_filename(procfile *ff) {
48 // An array of words
49
50 static inline void procfile_words_add(procfile *ff, char *str) {
51 - // debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str);
51 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str);
52
53 pfwords *fw = ff->words;
54 if(unlikely(fw->len == fw->size)) {
55 - // debug(D_PROCFILE, PF_PREFIX ": expanding words");
55 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding words");
56 size_t minimum = PFWORDS_INCREASE_STEP;
57 size_t optimal = fw->size / 2;
58 size_t wanted = (optimal > minimum)?optimal:minimum;
@@ -66,7 +66,7 @@ static inline void procfile_words_add(procfile *ff, char *str) {
66
67 NEVERNULL
68 static inline pfwords *procfile_words_create(void) {
69 - // debug(D_PROCFILE, PF_PREFIX ": initializing words");
69 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": initializing words");
70
71 size_t size = (procfile_adaptive_initial_allocation) ? procfile_max_words : PFWORDS_INCREASE_STEP;
72
@@ -77,12 +77,12 @@ static inline pfwords *procfile_words_create(void) {
77 }
78
79 static inline void procfile_words_reset(pfwords *fw) {
80 - // debug(D_PROCFILE, PF_PREFIX ": resetting words");
80 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting words");
81 fw->len = 0;
82 }
83
84 static inline void procfile_words_free(pfwords *fw) {
85 - // debug(D_PROCFILE, PF_PREFIX ": freeing words");
85 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": freeing words");
86
87 freez(fw);
88 }
@@ -93,11 +93,11 @@ static inline void procfile_words_free(pfwords *fw) {
93
94 NEVERNULL
95 static inline size_t *procfile_lines_add(procfile *ff) {
96 - // debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word);
96 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word);
97
98 pflines *fl = ff->lines;
99 if(unlikely(fl->len == fl->size)) {
100 - // debug(D_PROCFILE, PF_PREFIX ": expanding lines");
100 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding lines");
101 size_t minimum = PFLINES_INCREASE_STEP;
102 size_t optimal = fl->size / 2;
103 size_t wanted = (optimal > minimum)?optimal:minimum;
@@ -115,7 +115,7 @@ static inline size_t *procfile_lines_add(procfile *ff) {
115
116 NEVERNULL
117 static inline pflines *procfile_lines_create(void) {
118 - // debug(D_PROCFILE, PF_PREFIX ": initializing lines");
118 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": initializing lines");
119
120 size_t size = (unlikely(procfile_adaptive_initial_allocation)) ? procfile_max_words : PFLINES_INCREASE_STEP;
121
@@ -126,13 +126,13 @@ static inline pflines *procfile_lines_create(void) {
126 }
127
128 static inline void procfile_lines_reset(pflines *fl) {
129 - // debug(D_PROCFILE, PF_PREFIX ": resetting lines");
129 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting lines");
130
131 fl->len = 0;
132 }
133
134 static inline void procfile_lines_free(pflines *fl) {
135 - // debug(D_PROCFILE, PF_PREFIX ": freeing lines");
135 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": freeing lines");
136
137 freez(fl);
138 }
@@ -144,7 +144,7 @@ static inline void procfile_lines_free(pflines *fl) {
144 void procfile_close(procfile *ff) {
145 if(unlikely(!ff)) return;
146
147 - debug(D_PROCFILE, PF_PREFIX ": Closing file '%s'", procfile_filename(ff));
147 + netdata_log_debug(D_PROCFILE, PF_PREFIX ": Closing file '%s'", procfile_filename(ff));
148
149 freez(ff->filename);
150 procfile_lines_free(ff->lines);
@@ -156,7 +156,7 @@ void procfile_close(procfile *ff) {
156
157 NOINLINE
158 static void procfile_parser(procfile *ff) {
159 - // debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename);
159 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename);
160
161 char *s = ff->data // our current position
162 , *e = &ff->data[ff->len] // the terminating null
@@ -206,7 +206,7 @@ static void procfile_parser(procfile *ff) {
206 (*line_words)++;
207 t = ++s;
208
209 - // debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words);
209 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words);
210
211 line_words = procfile_lines_add(ff);
212 }
@@ -275,7 +275,7 @@ static void procfile_parser(procfile *ff) {
275 }
276
277 procfile *procfile_readall(procfile *ff) {
278 - // debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename);
278 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename);
279
280 ff->len = 0; // zero the used size
281 ssize_t r = 1; // read at least once
@@ -288,12 +288,12 @@ procfile *procfile_readall(procfile *ff) {
288 size_t optimal = ff->size / 2;
289 size_t wanted = (optimal > minimum)?optimal:minimum;
290
291 - debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s' by %zu bytes.", procfile_filename(ff), wanted);
291 + netdata_log_debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s' by %zu bytes.", procfile_filename(ff), wanted);
292 ff = reallocz(ff, sizeof(procfile) + ff->size + wanted);
293 ff->size += wanted;
294 }
295
296 - debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
296 + netdata_log_debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
297 r = read(ff->fd, &ff->data[s], ff->size - s);
298 if(unlikely(r == -1)) {
299 if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) collector_error(PF_PREFIX ": Cannot read from file '%s' on fd %d", procfile_filename(ff), ff->fd);
@@ -306,7 +306,7 @@ procfile *procfile_readall(procfile *ff) {
306 ff->len += r;
307 }
308
309 - // debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
309 + // netdata_log_debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
310 if(unlikely(lseek(ff->fd, 0, SEEK_SET) == -1)) {
311 if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) collector_error(PF_PREFIX ": Cannot rewind on file '%s'.", procfile_filename(ff));
312 else if(unlikely(ff->flags & PROCFILE_FLAG_ERROR_ON_ERROR_LOG))
@@ -325,7 +325,7 @@ procfile *procfile_readall(procfile *ff) {
325 if(unlikely(ff->words->len > procfile_max_words)) procfile_max_words = ff->words->len;
326 }
327
328 - // debug(D_PROCFILE, "File '%s' updated.", ff->filename);
328 + // netdata_log_debug(D_PROCFILE, "File '%s' updated.", ff->filename);
329 return ff;
330 }
331
@@ -403,7 +403,7 @@ void procfile_set_open_close(procfile *ff, const char *open, const char *close)
403 }
404
405 procfile *procfile_open(const char *filename, const char *separators, uint32_t flags) {
406 - debug(D_PROCFILE, PF_PREFIX ": Opening file '%s'", filename);
406 + netdata_log_debug(D_PROCFILE, PF_PREFIX ": Opening file '%s'", filename);
407
408 int fd = open(filename, procfile_open_flags, 0666);
409 if(unlikely(fd == -1)) {
@@ -430,7 +430,7 @@ procfile *procfile_open(const char *filename, const char *separators, uint32_t f
430
431 procfile_set_separators(ff, separators);
432
433 - debug(D_PROCFILE, "File '%s' opened.", filename);
433 + netdata_log_debug(D_PROCFILE, "File '%s' opened.", filename);
434 return ff;
435 }
436
@@ -469,17 +469,17 @@ void procfile_print(procfile *ff) {
469 char *s;
470 (void)s;
471
472 - debug(D_PROCFILE, "File '%s' with %zu lines and %zu words", procfile_filename(ff), ff->lines->len, ff->words->len);
472 + netdata_log_debug(D_PROCFILE, "File '%s' with %zu lines and %zu words", procfile_filename(ff), ff->lines->len, ff->words->len);
473
474 for(l = 0; likely(l < lines) ;l++) {
475 size_t words = procfile_linewords(ff, l);
476
477 - debug(D_PROCFILE, " line %zu starts at word %zu and has %zu words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
477 + netdata_log_debug(D_PROCFILE, " line %zu starts at word %zu and has %zu words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
478
479 size_t w;
480 for(w = 0; likely(w < words) ;w++) {
481 s = procfile_lineword(ff, l, w);
482 - debug(D_PROCFILE, " [%zu.%zu] '%s'", l, w, s);
482 + netdata_log_debug(D_PROCFILE, " [%zu.%zu] '%s'", l, w, s);
483 }
484 }
485 }
libnetdata/simple_pattern/simple_pattern.c
+2 -2
@@ -326,10 +326,10 @@ extern void simple_pattern_dump(uint64_t debug_type, SIMPLE_PATTERN *p)
326 {
327 struct simple_pattern *root = (struct simple_pattern *)p;
328 if(root==NULL) {
329 - debug(debug_type,"dump_pattern(NULL)");
329 + netdata_log_debug(debug_type,"dump_pattern(NULL)");
330 return;
331 }
332 - debug(debug_type,"dump_pattern(%p) child=%p next=%p mode=%u match=%s", root, root->child, root->next, root->mode,
332 + netdata_log_debug(debug_type,"dump_pattern(%p) child=%p next=%p mode=%u match=%s", root, root->child, root->next, root->mode,
333 root->match);
334 if(root->child!=NULL)
335 simple_pattern_dump(debug_type, (SIMPLE_PATTERN*)root->child);
libnetdata/socket/security.c
+2 -2
@@ -406,7 +406,7 @@ bool netdata_ssl_accept(NETDATA_SSL *ssl) {
406 static void netdata_ssl_info_callback(const SSL *ssl, int where, int ret __maybe_unused) {
407 (void)ssl;
408 if (where & SSL_CB_ALERT) {
409 - debug(D_WEB_CLIENT,"SSL INFO CALLBACK %s %s", SSL_alert_type_string(ret), SSL_alert_desc_string_long(ret));
409 + netdata_log_debug(D_WEB_CLIENT,"SSL INFO CALLBACK %s %s", SSL_alert_type_string(ret), SSL_alert_desc_string_long(ret));
410 }
411 }
412
@@ -559,7 +559,7 @@ static SSL_CTX * netdata_ssl_create_server_ctx(unsigned long mode) {
559 #if (OPENSSL_VERSION_NUMBER < OPENSSL_VERSION_095)
560 SSL_CTX_set_verify_depth(ctx,1);
561 #endif
562 - debug(D_WEB_CLIENT,"SSL GLOBAL CONTEXT STARTED\n");
562 + netdata_log_debug(D_WEB_CLIENT,"SSL GLOBAL CONTEXT STARTED\n");
563
564 SSL_CTX_set_mode(ctx, mode);
565
libnetdata/socket/socket.c
+40 -40
@@ -216,7 +216,7 @@ char *strdup_client_description(int family, const char *protocol, const char *ip
216 int create_listen_socket_unix(const char *path, int listen_backlog) {
217 int sock;
218
219 - debug(D_LISTENER, "LISTENER: UNIX creating new listening socket on path '%s'", path);
219 + netdata_log_debug(D_LISTENER, "LISTENER: UNIX creating new listening socket on path '%s'", path);
220
221 sock = socket(AF_UNIX, SOCK_STREAM, 0);
222 if(sock < 0) {
@@ -253,14 +253,14 @@ int create_listen_socket_unix(const char *path, int listen_backlog) {
253 return -1;
254 }
255
256 - debug(D_LISTENER, "LISTENER: Listening on UNIX path '%s'", path);
256 + netdata_log_debug(D_LISTENER, "LISTENER: Listening on UNIX path '%s'", path);
257 return sock;
258 }
259
260 int create_listen_socket4(int socktype, const char *ip, uint16_t port, int listen_backlog) {
261 int sock;
262
263 - debug(D_LISTENER, "LISTENER: IPv4 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
263 + netdata_log_debug(D_LISTENER, "LISTENER: IPv4 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
264
265 sock = socket(AF_INET, socktype, 0);
266 if(sock < 0) {
@@ -297,7 +297,7 @@ int create_listen_socket4(int socktype, const char *ip, uint16_t port, int liste
297 return -1;
298 }
299
300 - debug(D_LISTENER, "LISTENER: Listening on IPv4 ip '%s' port %d, socktype %d", ip, port, socktype);
300 + netdata_log_debug(D_LISTENER, "LISTENER: Listening on IPv4 ip '%s' port %d, socktype %d", ip, port, socktype);
301 return sock;
302 }
303
@@ -305,7 +305,7 @@ int create_listen_socket6(int socktype, uint32_t scope_id, const char *ip, int p
305 int sock;
306 int ipv6only = 1;
307
308 - debug(D_LISTENER, "LISTENER: IPv6 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
308 + netdata_log_debug(D_LISTENER, "LISTENER: IPv6 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
309
310 sock = socket(AF_INET6, socktype, 0);
311 if (sock < 0) {
@@ -349,7 +349,7 @@ int create_listen_socket6(int socktype, uint32_t scope_id, const char *ip, int p
349 return -1;
350 }
351
352 - debug(D_LISTENER, "LISTENER: Listening on IPv6 ip '%s' port %d, socktype %d", ip, port, socktype);
352 + netdata_log_debug(D_LISTENER, "LISTENER: Listening on IPv6 ip '%s' port %d, socktype %d", ip, port, socktype);
353 return sock;
354 }
355
@@ -603,7 +603,7 @@ static inline int bind_to_this(LISTEN_SOCKETS *sockets, const char *definition,
603 }
604
605 default:
606 - debug(D_LISTENER, "LISTENER: Unknown socket family %d", family);
606 + netdata_log_debug(D_LISTENER, "LISTENER: Unknown socket family %d", family);
607 break;
608 }
609
@@ -635,7 +635,7 @@ int listen_sockets_setup(LISTEN_SOCKETS *sockets) {
635 }
636 else sockets->default_port = (uint16_t)new_port;
637
638 - debug(D_OPTIONS, "LISTENER: Default listen port set to %d.", sockets->default_port);
638 + netdata_log_debug(D_OPTIONS, "LISTENER: Default listen port set to %d.", sockets->default_port);
639
640 char *s = appconfig_get(sockets->config, sockets->config_section, "bind to", sockets->default_bind_to);
641 while(*s) {
@@ -697,7 +697,7 @@ static inline int connect_to_unix(const char *path, struct timeval *timeout) {
697 return -1;
698 }
699
700 - debug(D_CONNECT_TO, "Connected to UNIX socket on path '%s'.", path);
700 + netdata_log_debug(D_CONNECT_TO, "Connected to UNIX socket on path '%s'.", path);
701
702 return fd;
703 }
@@ -748,7 +748,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
748 sizeof(servBfr),
749 NI_NUMERICHOST | NI_NUMERICSERV);
750
751 - debug(D_CONNECT_TO, "Address info: host = '%s', service = '%s', ai_flags = 0x%02X, ai_family = %d (PF_INET = %d, PF_INET6 = %d), ai_socktype = %d (SOCK_STREAM = %d, SOCK_DGRAM = %d), ai_protocol = %d (IPPROTO_TCP = %d, IPPROTO_UDP = %d), ai_addrlen = %lu (sockaddr_in = %lu, sockaddr_in6 = %lu)",
751 + netdata_log_debug(D_CONNECT_TO, "Address info: host = '%s', service = '%s', ai_flags = 0x%02X, ai_family = %d (PF_INET = %d, PF_INET6 = %d), ai_socktype = %d (SOCK_STREAM = %d, SOCK_DGRAM = %d), ai_protocol = %d (IPPROTO_TCP = %d, IPPROTO_UDP = %d), ai_addrlen = %lu (sockaddr_in = %lu, sockaddr_in6 = %lu)",
752 hostBfr,
753 servBfr,
754 (unsigned int)ai->ai_flags,
@@ -770,7 +770,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
770 struct sockaddr_in *pSadrIn = (struct sockaddr_in *)ai->ai_addr;
771 (void)pSadrIn;
772
773 - debug(D_CONNECT_TO, "ai_addr = sin_family: %d (AF_INET = %d, AF_INET6 = %d), sin_addr: '%s', sin_port: '%s'",
773 + netdata_log_debug(D_CONNECT_TO, "ai_addr = sin_family: %d (AF_INET = %d, AF_INET6 = %d), sin_addr: '%s', sin_port: '%s'",
774 pSadrIn->sin_family,
775 AF_INET,
776 AF_INET6,
@@ -783,7 +783,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
783 struct sockaddr_in6 *pSadrIn6 = (struct sockaddr_in6 *) ai->ai_addr;
784 (void)pSadrIn6;
785
786 - debug(D_CONNECT_TO,"ai_addr = sin6_family: %d (AF_INET = %d, AF_INET6 = %d), sin6_addr: '%s', sin6_port: '%s', sin6_flowinfo: %u, sin6_scope_id: %u",
786 + netdata_log_debug(D_CONNECT_TO,"ai_addr = sin6_family: %d (AF_INET = %d, AF_INET6 = %d), sin6_addr: '%s', sin6_port: '%s', sin6_flowinfo: %u, sin6_scope_id: %u",
787 pSadrIn6->sin6_family,
788 AF_INET,
789 AF_INET6,
@@ -795,7 +795,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
795 }
796
797 default: {
798 - debug(D_CONNECT_TO, "Unknown protocol family %d.", ai->ai_family);
798 + netdata_log_debug(D_CONNECT_TO, "Unknown protocol family %d.", ai->ai_family);
799 continue;
800 }
801 }
@@ -854,7 +854,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
854 }
855
856 if(fd != -1)
857 - debug(D_CONNECT_TO, "Connected to '%s' on port '%s'.", hostBfr, servBfr);
857 + netdata_log_debug(D_CONNECT_TO, "Connected to '%s' on port '%s'.", hostBfr, servBfr);
858 }
859 }
860
@@ -930,7 +930,7 @@ int connect_to_this(const char *definition, int default_port, struct timeval *ti
930 service = e;
931 }
932
933 - debug(D_CONNECT_TO, "Attempting connection to host = '%s', service = '%s', interface = '%s', protocol = %d (tcp = %d, udp = %d)", host, service, interface, protocol, IPPROTO_TCP, IPPROTO_UDP);
933 + netdata_log_debug(D_CONNECT_TO, "Attempting connection to host = '%s', service = '%s', interface = '%s', protocol = %d (tcp = %d, udp = %d)", host, service, interface, protocol, IPPROTO_TCP, IPPROTO_UDP);
934
935 if(!*host) {
936 netdata_log_error("Definition '%s' does not specify a host.", definition);
@@ -1189,7 +1189,7 @@ int accept4(int sock, struct sockaddr *addr, socklen_t *addrlen, int flags) {
1189 int connection_allowed(int fd, char *client_ip, char *client_host, size_t hostsize, SIMPLE_PATTERN *access_list,
1190 const char *patname, int allow_dns)
1191 {
1192 - debug(D_LISTENER,"checking %s... (allow_dns=%d)", patname, allow_dns);
1192 + netdata_log_debug(D_LISTENER,"checking %s... (allow_dns=%d)", patname, allow_dns);
1193 if (!access_list)
1194 return 1;
1195 if (simple_pattern_matches(access_list, client_ip))
@@ -1231,7 +1231,7 @@ int connection_allowed(int fd, char *client_ip, char *client_host, size_t hostsi
1231 inet_ntop(AF_INET6, &((struct sockaddr_in6*)(scan->ai_addr))->sin6_addr, address, INET6_ADDRSTRLEN);
1232 break;
1233 }
1234 - debug(D_LISTENER, "Incoming ip %s rev-resolved onto %s, validating against forward-resolution %s",
1234 + netdata_log_debug(D_LISTENER, "Incoming ip %s rev-resolved onto %s, validating against forward-resolution %s",
1235 client_ip, client_host, address);
1236 if (!strcmp(client_ip, address)) {
1237 validated = 1;
@@ -1248,7 +1248,7 @@ int connection_allowed(int fd, char *client_ip, char *client_host, size_t hostsi
1248 freeaddrinfo(addr_infos);
1249 }
1250 if (!simple_pattern_matches(access_list, client_host)) {
1251 - debug(D_LISTENER, "Incoming connection on '%s' (%s) does not match allowed pattern for %s",
1251 + netdata_log_debug(D_LISTENER, "Incoming connection on '%s' (%s) does not match allowed pattern for %s",
1252 client_ip, client_host, patname);
1253 return 0;
1254 }
@@ -1284,26 +1284,26 @@ int accept_socket(int fd, int flags, char *client_ip, size_t ipsize, char *clien
1284
1285 switch (((struct sockaddr *)&sadr)->sa_family) {
1286 case AF_UNIX:
1287 - debug(D_LISTENER, "New UNIX domain web client from %s on socket %d.", client_ip, fd);
1287 + netdata_log_debug(D_LISTENER, "New UNIX domain web client from %s on socket %d.", client_ip, fd);
1288 // set the port - certain versions of libc return garbage on unix sockets
1289 strncpyz(client_port, "UNIX", portsize);
1290 break;
1291
1292 case AF_INET:
1293 - debug(D_LISTENER, "New IPv4 web client from %s port %s on socket %d.", client_ip, client_port, fd);
1293 + netdata_log_debug(D_LISTENER, "New IPv4 web client from %s port %s on socket %d.", client_ip, client_port, fd);
1294 break;
1295
1296 case AF_INET6:
1297 if (strncmp(client_ip, "::ffff:", 7) == 0) {
1298 memmove(client_ip, &client_ip[7], strlen(&client_ip[7]) + 1);
1299 - debug(D_LISTENER, "New IPv4 web client from %s port %s on socket %d.", client_ip, client_port, fd);
1299 + netdata_log_debug(D_LISTENER, "New IPv4 web client from %s port %s on socket %d.", client_ip, client_port, fd);
1300 }
1301 else
1302 - debug(D_LISTENER, "New IPv6 web client from %s port %s on socket %d.", client_ip, client_port, fd);
1302 + netdata_log_debug(D_LISTENER, "New IPv6 web client from %s port %s on socket %d.", client_ip, client_port, fd);
1303 break;
1304
1305 default:
1306 - debug(D_LISTENER, "New UNKNOWN web client from %s port %s on socket %d.", client_ip, client_port, fd);
1306 + netdata_log_debug(D_LISTENER, "New UNKNOWN web client from %s port %s on socket %d.", client_ip, client_port, fd);
1307 break;
1308 }
1309 if (!connection_allowed(nfd, client_ip, client_host, hostsize, access_list, "connection", allow_dns)) {
@@ -1344,7 +1344,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
1344 , int (*snd_callback)(POLLINFO * /*pi*/, short int * /*events*/)
1345 , void *data
1346 ) {
1347 - debug(D_POLLFD, "POLLFD: ADD: request to add fd %d, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", fd, p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1347 + netdata_log_debug(D_POLLFD, "POLLFD: ADD: request to add fd %d, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", fd, p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1348
1349 if(unlikely(fd < 0)) return NULL;
1350
@@ -1356,7 +1356,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
1356
1357 if(unlikely(!p->first_free)) {
1358 size_t new_slots = p->slots + POLL_FDS_INCREASE_STEP;
1359 - debug(D_POLLFD, "POLLFD: ADD: increasing size (current = %zu, new = %zu, used = %zu, min = %zu, max = %zu)", p->slots, new_slots, p->used, p->min, p->max);
1359 + netdata_log_debug(D_POLLFD, "POLLFD: ADD: increasing size (current = %zu, new = %zu, used = %zu, min = %zu, max = %zu)", p->slots, new_slots, p->used, p->min, p->max);
1360
1361 p->fds = reallocz(p->fds, sizeof(struct pollfd) * new_slots);
1362 p->inf = reallocz(p->inf, sizeof(POLLINFO) * new_slots);
@@ -1364,7 +1364,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
1364 // reset all the newly added slots
1365 ssize_t i;
1366 for(i = new_slots - 1; i >= (ssize_t)p->slots ; i--) {
1367 - debug(D_POLLFD, "POLLFD: ADD: resetting new slot %zd", i);
1367 + netdata_log_debug(D_POLLFD, "POLLFD: ADD: resetting new slot %zd", i);
1368 p->fds[i].fd = -1;
1369 p->fds[i].events = 0;
1370 p->fds[i].revents = 0;
@@ -1395,7 +1395,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
1395 POLLINFO *pi = p->first_free;
1396 p->first_free = p->first_free->next;
1397
1398 - debug(D_POLLFD, "POLLFD: ADD: selected slot %zu, next free is %zd", pi->slot, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1398 + netdata_log_debug(D_POLLFD, "POLLFD: ADD: selected slot %zu, next free is %zd", pi->slot, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1399
1400 struct pollfd *pf = &p->fds[pi->slot];
1401 pf->fd = fd;
@@ -1437,7 +1437,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
1437 }
1438 netdata_thread_enable_cancelability();
1439
1440 - debug(D_POLLFD, "POLLFD: ADD: completed, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1440 + netdata_log_debug(D_POLLFD, "POLLFD: ADD: completed, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1441
1442 return pi;
1443 }
@@ -1446,7 +1446,7 @@ inline void poll_close_fd(POLLINFO *pi) {
1446 POLLJOB *p = pi->p;
1447
1448 struct pollfd *pf = &p->fds[pi->slot];
1449 - debug(D_POLLFD, "POLLFD: DEL: request to clear slot %zu (fd %d), old next free was %zd", pi->slot, pf->fd, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1449 + netdata_log_debug(D_POLLFD, "POLLFD: DEL: request to clear slot %zu (fd %d), old next free was %zd", pi->slot, pf->fd, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1450
1451 if(unlikely(pf->fd == -1)) return;
1452
@@ -1499,7 +1499,7 @@ inline void poll_close_fd(POLLINFO *pi) {
1499 }
1500 netdata_thread_enable_cancelability();
1501
1502 - debug(D_POLLFD, "POLLFD: DEL: completed, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1502 + netdata_log_debug(D_POLLFD, "POLLFD: DEL: completed, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
1503 }
1504
1505 void *poll_default_add_callback(POLLINFO *pi, short int *events, void *data) {
@@ -1586,7 +1586,7 @@ static inline int poll_process_send(POLLJOB *p, POLLINFO *pi, struct pollfd *pf,
1586 pi->last_sent_t = now;
1587 pi->send_count++;
1588
1589 - debug(D_POLLFD, "POLLFD: LISTENER: sending data to socket on slot %zu (fd %d)", pi->slot, pf->fd);
1589 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: sending data to socket on slot %zu (fd %d)", pi->slot, pf->fd);
1590
1591 pf->events = 0;
1592
@@ -1607,7 +1607,7 @@ static inline int poll_process_tcp_read(POLLJOB *p, POLLINFO *pi, struct pollfd
1607 pi->last_received_t = now;
1608 pi->recv_count++;
1609
1610 - debug(D_POLLFD, "POLLFD: LISTENER: reading data from TCP client slot %zu (fd %d)", pi->slot, pf->fd);
1610 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: reading data from TCP client slot %zu (fd %d)", pi->slot, pf->fd);
1611
1612 pf->events = 0;
1613
@@ -1628,7 +1628,7 @@ static inline int poll_process_udp_read(POLLINFO *pi, struct pollfd *pf, time_t
1628 pi->last_received_t = now;
1629 pi->recv_count++;
1630
1631 - debug(D_POLLFD, "POLLFD: LISTENER: reading data from UDP slot %zu (fd %d)", pi->slot, pf->fd);
1631 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: reading data from UDP slot %zu (fd %d)", pi->slot, pf->fd);
1632
1633 // TODO: access_list is not applied to UDP
1634 // but checking the access list on every UDP packet will destroy
@@ -1648,13 +1648,13 @@ static int poll_process_new_tcp_connection(POLLJOB *p, POLLINFO *pi, struct poll
1648 pi->last_received_t = now;
1649 pi->recv_count++;
1650
1651 - debug(D_POLLFD, "POLLFD: LISTENER: accepting connections from slot %zu (fd %d)", pi->slot, pf->fd);
1651 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: accepting connections from slot %zu (fd %d)", pi->slot, pf->fd);
1652
1653 char client_ip[INET6_ADDRSTRLEN] = "";
1654 char client_port[NI_MAXSERV] = "";
1655 char client_host[NI_MAXHOST] = "";
1656
1657 - debug(D_POLLFD, "POLLFD: LISTENER: calling accept4() slot %zu (fd %d)", pi->slot, pf->fd);
1657 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: calling accept4() slot %zu (fd %d)", pi->slot, pf->fd);
1658
1659 int nfd = accept_socket(
1660 pf->fd,SOCK_NONBLOCK,
@@ -1665,7 +1665,7 @@ static int poll_process_new_tcp_connection(POLLJOB *p, POLLINFO *pi, struct poll
1665 if (unlikely(nfd < 0)) {
1666 // accept failed
1667
1668 - debug(D_POLLFD, "POLLFD: LISTENER: accept4() slot %zu (fd %d) failed.", pi->slot, pf->fd);
1668 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: accept4() slot %zu (fd %d) failed.", pi->slot, pf->fd);
1669
1670 if(unlikely(errno == EMFILE)) {
1671 error_limit_static_global_var(erl, 10, 1000);
@@ -1797,7 +1797,7 @@ void poll_events(LISTEN_SOCKETS *sockets
1797 now_usec = now_boottime_usec();
1798
1799 if(unlikely(timer_usec && now_usec >= next_timer_usec)) {
1800 - debug(D_POLLFD, "Calling timer callback after %zu usec", (size_t)(now_usec - last_timer_usec));
1800 + netdata_log_debug(D_POLLFD, "Calling timer callback after %zu usec", (size_t)(now_usec - last_timer_usec));
1801 last_timer_usec = now_usec;
1802 p.tmr_callback(p.timer_data);
1803 now_usec = now_boottime_usec();
@@ -1822,7 +1822,7 @@ void poll_events(LISTEN_SOCKETS *sockets
1822 }
1823 }
1824
1825 - debug(D_POLLFD, "POLLFD: LISTENER: Waiting on %zu sockets for %zu ms...", p.max + 1, (size_t)timeout_ms);
1825 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: Waiting on %zu sockets for %zu ms...", p.max + 1, (size_t)timeout_ms);
1826 retval = poll(p.fds, p.max + 1, timeout_ms);
1827 time_t now = now_boottime_sec();
1828
@@ -1831,7 +1831,7 @@ void poll_events(LISTEN_SOCKETS *sockets
1831 break;
1832 }
1833 else if(unlikely(!retval)) {
1834 - debug(D_POLLFD, "POLLFD: LISTENER: poll() timeout.");
1834 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: poll() timeout.");
1835 }
1836 else {
1837 POLLINFO *pi;
@@ -1987,5 +1987,5 @@ void poll_events(LISTEN_SOCKETS *sockets
1987 }
1988
1989 netdata_thread_cleanup_pop(1);
1990 - debug(D_POLLFD, "POLLFD: LISTENER: cleanup completed");
1990 + netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: cleanup completed");
1991 }
libnetdata/threads/threads.c
+1 -1
@@ -133,7 +133,7 @@ size_t netdata_threads_init(void) {
133 if(i != 0)
134 fatal("pthread_attr_getstacksize() failed with code %d.", i);
135 else
136 - debug(D_OPTIONS, "initial pthread stack size is %zu bytes", stacksize);
136 + netdata_log_debug(D_OPTIONS, "initial pthread stack size is %zu bytes", stacksize);
137
138 return stacksize;
139 }
registry/registry_db.c
+22 -22
@@ -4,7 +4,7 @@
4 #include "registry_internals.h"
5
6 int registry_db_should_be_saved(void) {
7 - debug(D_REGISTRY, "log entries %llu, max %llu", registry.log_count, registry.save_registry_every_entries);
7 + netdata_log_debug(D_REGISTRY, "log entries %llu, max %llu", registry.log_count, registry.save_registry_every_entries);
8 return registry.log_count > registry.save_registry_every_entries;
9 }
10
@@ -12,7 +12,7 @@ int registry_db_should_be_saved(void) {
12 // INTERNAL FUNCTIONS FOR SAVING REGISTRY OBJECTS
13
14 static int registry_machine_save_url(REGISTRY_MACHINE_URL *mu, FILE *fp) {
15 - debug(D_REGISTRY, "REGISTRY: registry_machine_save_url('%s')", string2str(mu->url));
15 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_save_url('%s')", string2str(mu->url));
16
17 int ret = fprintf(fp, "V\t%08x\t%08x\t%08x\t%02x\t%s\n",
18 mu->first_t,
@@ -32,7 +32,7 @@ static int registry_machine_save(const DICTIONARY_ITEM *item __maybe_unused, voi
32 REGISTRY_MACHINE *m = entry;
33 FILE *fp = file;
34
35 - debug(D_REGISTRY, "REGISTRY: registry_machine_save('%s')", m->guid);
35 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_save('%s')", m->guid);
36
37 int ret = fprintf(fp, "M\t%08x\t%08x\t%08x\t%s\n",
38 m->first_t,
@@ -57,7 +57,7 @@ static int registry_machine_save(const DICTIONARY_ITEM *item __maybe_unused, voi
57 }
58
59 static inline int registry_person_save_url(REGISTRY_PERSON_URL *pu, FILE *fp) {
60 - debug(D_REGISTRY, "REGISTRY: registry_person_save_url('%s')", string2str(pu->url));
60 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_person_save_url('%s')", string2str(pu->url));
61
62 int ret = fprintf(fp, "U\t%08x\t%08x\t%08x\t%02x\t%s\t%s\t%s\n",
63 pu->first_t,
@@ -78,7 +78,7 @@ static inline int registry_person_save(const DICTIONARY_ITEM *item __maybe_unuse
78 REGISTRY_PERSON *p = entry;
79 FILE *fp = file;
80
81 - debug(D_REGISTRY, "REGISTRY: registry_person_save('%s')", p->guid);
81 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_person_save('%s')", p->guid);
82
83 int ret = fprintf(fp, "P\t%08x\t%08x\t%08x\t%s\n",
84 p->first_t,
@@ -120,7 +120,7 @@ int registry_db_save(void) {
120 snprintfz(old_filename, FILENAME_MAX, "%s.old", registry.db_filename);
121 snprintfz(tmp_filename, FILENAME_MAX, "%s.tmp", registry.db_filename);
122
123 - debug(D_REGISTRY, "REGISTRY: Creating file '%s'", tmp_filename);
123 + netdata_log_debug(D_REGISTRY, "REGISTRY: Creating file '%s'", tmp_filename);
124 FILE *fp = fopen(tmp_filename, "w");
125 if(!fp) {
126 netdata_log_error("REGISTRY: Cannot create file: %s", tmp_filename);
@@ -130,7 +130,7 @@ int registry_db_save(void) {
130
131 // dictionary_walkthrough_read() has its own locking, so this is safe to do
132
133 - debug(D_REGISTRY, "REGISTRY: saving all machines");
133 + netdata_log_debug(D_REGISTRY, "REGISTRY: saving all machines");
134 int bytes1 = dictionary_walkthrough_read(registry.machines, registry_machine_save, fp);
135 if(bytes1 < 0) {
136 netdata_log_error("REGISTRY: Cannot save registry machines - return value %d", bytes1);
@@ -138,9 +138,9 @@ int registry_db_save(void) {
138 error_log_limit_reset();
139 return bytes1;
140 }
141 - debug(D_REGISTRY, "REGISTRY: saving machines took %d bytes", bytes1);
141 + netdata_log_debug(D_REGISTRY, "REGISTRY: saving machines took %d bytes", bytes1);
142
143 - debug(D_REGISTRY, "Saving all persons");
143 + netdata_log_debug(D_REGISTRY, "Saving all persons");
144 int bytes2 = dictionary_walkthrough_read(registry.persons, registry_person_save, fp);
145 if(bytes2 < 0) {
146 netdata_log_error("REGISTRY: Cannot save registry persons - return value %d", bytes2);
@@ -148,7 +148,7 @@ int registry_db_save(void) {
148 error_log_limit_reset();
149 return bytes2;
150 }
151 - debug(D_REGISTRY, "REGISTRY: saving persons took %d bytes", bytes2);
151 + netdata_log_debug(D_REGISTRY, "REGISTRY: saving persons took %d bytes", bytes2);
152
153 // save the totals
154 fprintf(fp, "T\t%016llx\t%016llx\t%016llx\t%016llx\t%016llx\t%016llx\n",
@@ -165,34 +165,34 @@ int registry_db_save(void) {
165 errno = 0;
166
167 // remove the .old db
168 - debug(D_REGISTRY, "REGISTRY: Removing old db '%s'", old_filename);
168 + netdata_log_debug(D_REGISTRY, "REGISTRY: Removing old db '%s'", old_filename);
169 if(unlink(old_filename) == -1 && errno != ENOENT)
170 netdata_log_error("REGISTRY: cannot remove old registry file '%s'", old_filename);
171
172 // rename the db to .old
173 - debug(D_REGISTRY, "REGISTRY: Link current db '%s' to .old: '%s'", registry.db_filename, old_filename);
173 + netdata_log_debug(D_REGISTRY, "REGISTRY: Link current db '%s' to .old: '%s'", registry.db_filename, old_filename);
174 if(link(registry.db_filename, old_filename) == -1 && errno != ENOENT)
175 netdata_log_error("REGISTRY: cannot move file '%s' to '%s'. Saving registry DB failed!", registry.db_filename, old_filename);
176
177 else {
178 // remove the database (it is saved in .old)
179 - debug(D_REGISTRY, "REGISTRY: removing db '%s'", registry.db_filename);
179 + netdata_log_debug(D_REGISTRY, "REGISTRY: removing db '%s'", registry.db_filename);
180 if (unlink(registry.db_filename) == -1 && errno != ENOENT)
181 netdata_log_error("REGISTRY: cannot remove old registry file '%s'", registry.db_filename);
182
183 // move the .tmp to make it active
184 - debug(D_REGISTRY, "REGISTRY: linking tmp db '%s' to active db '%s'", tmp_filename, registry.db_filename);
184 + netdata_log_debug(D_REGISTRY, "REGISTRY: linking tmp db '%s' to active db '%s'", tmp_filename, registry.db_filename);
185 if (link(tmp_filename, registry.db_filename) == -1) {
186 netdata_log_error("REGISTRY: cannot move file '%s' to '%s'. Saving registry DB failed!", tmp_filename,
187 registry.db_filename);
188
189 // move the .old back
190 - debug(D_REGISTRY, "REGISTRY: linking old db '%s' to active db '%s'", old_filename, registry.db_filename);
190 + netdata_log_debug(D_REGISTRY, "REGISTRY: linking old db '%s' to active db '%s'", old_filename, registry.db_filename);
191 if(link(old_filename, registry.db_filename) == -1)
192 netdata_log_error("REGISTRY: cannot move file '%s' to '%s'. Recovering the old registry DB failed!", old_filename, registry.db_filename);
193 }
194 else {
195 - debug(D_REGISTRY, "REGISTRY: removing tmp db '%s'", tmp_filename);
195 + netdata_log_debug(D_REGISTRY, "REGISTRY: removing tmp db '%s'", tmp_filename);
196 if(unlink(tmp_filename) == -1)
197 netdata_log_error("REGISTRY: cannot remove tmp registry file '%s'", tmp_filename);
198
@@ -219,7 +219,7 @@ size_t registry_db_load(void) {
219 STRING *u = NULL;
220 size_t line = 0;
221
222 - debug(D_REGISTRY, "REGISTRY: loading active db from: '%s'", registry.db_filename);
222 + netdata_log_debug(D_REGISTRY, "REGISTRY: loading active db from: '%s'", registry.db_filename);
223 FILE *fp = fopen(registry.db_filename, "r");
224 if(!fp) {
225 netdata_log_error("REGISTRY: cannot open registry file: '%s'", registry.db_filename);
@@ -232,7 +232,7 @@ size_t registry_db_load(void) {
232 while((s = fgets_trim_len(buf, 4096, fp, &len))) {
233 line++;
234
235 - debug(D_REGISTRY, "REGISTRY: read line %zu to length %zu: %s", line, len, s);
235 + netdata_log_debug(D_REGISTRY, "REGISTRY: read line %zu to length %zu: %s", line, len, s);
236 switch(*s) {
237 case 'U': // person URL
238 if(unlikely(!p)) {
@@ -284,7 +284,7 @@ size_t registry_db_load(void) {
284 pu->last_t = (uint32_t)strtoul(&s[11], NULL, 16);
285 pu->usages = (uint32_t)strtoul(&s[20], NULL, 16);
286 pu->flags = (uint8_t)strtoul(&s[29], NULL, 16);
287 - debug(D_REGISTRY, "REGISTRY: loaded person URL '%s' with name '%s' of machine '%s', first: %u, last: %u, usages: %u, flags: %02x",
287 + netdata_log_debug(D_REGISTRY, "REGISTRY: loaded person URL '%s' with name '%s' of machine '%s', first: %u, last: %u, usages: %u, flags: %02x",
288 string2str(u), string2str(pu->machine_name), m->guid, pu->first_t, pu->last_t, pu->usages, pu->flags);
289
290 string_freez(u);
@@ -302,7 +302,7 @@ size_t registry_db_load(void) {
302 p = registry_person_allocate(&s[29], (time_t)strtoul(&s[2], NULL, 16));
303 p->last_t = (uint32_t)strtoul(&s[11], NULL, 16);
304 p->usages = (uint32_t)strtoul(&s[20], NULL, 16);
305 - debug(D_REGISTRY, "REGISTRY: loaded person '%s', first: %u, last: %u, usages: %u", p->guid, p->first_t, p->last_t, p->usages);
305 + netdata_log_debug(D_REGISTRY, "REGISTRY: loaded person '%s', first: %u, last: %u, usages: %u", p->guid, p->first_t, p->last_t, p->usages);
306 break;
307
308 case 'V': // machine URL
@@ -336,7 +336,7 @@ size_t registry_db_load(void) {
336 mu->last_t = (uint32_t)strtoul(&s[11], NULL, 16);
337 mu->usages = (uint32_t)strtoul(&s[20], NULL, 16);
338 mu->flags = (uint8_t)strtoul(&s[29], NULL, 16);
339 - debug(D_REGISTRY, "Registry loaded machine URL '%s', machine '%s', first: %u, last: %u, usages: %u, flags: %02x",
339 + netdata_log_debug(D_REGISTRY, "Registry loaded machine URL '%s', machine '%s', first: %u, last: %u, usages: %u, flags: %02x",
340 string2str(u), m->guid, mu->first_t, mu->last_t, mu->usages, mu->flags);
341
342 string_freez(u);
@@ -354,7 +354,7 @@ size_t registry_db_load(void) {
354 m = registry_machine_allocate(&s[29], (time_t)strtoul(&s[2], NULL, 16));
355 m->last_t = (uint32_t)strtoul(&s[11], NULL, 16);
356 m->usages = (uint32_t)strtoul(&s[20], NULL, 16);
357 - debug(D_REGISTRY, "REGISTRY: loaded machine '%s', first: %u, last: %u, usages: %u", m->guid, m->first_t, m->last_t, m->usages);
357 + netdata_log_debug(D_REGISTRY, "REGISTRY: loaded machine '%s', first: %u, last: %u, usages: %u", m->guid, m->first_t, m->last_t, m->usages);
358 break;
359
360 case 'T': // totals
registry/registry_init.c
+4 -4
@@ -210,7 +210,7 @@ static int machine_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, v
210 static int registry_person_del_callback(const DICTIONARY_ITEM *item __maybe_unused, void *entry, void *d __maybe_unused) {
211 REGISTRY_PERSON *p = (REGISTRY_PERSON *)entry;
212
213 - debug(D_REGISTRY, "Registry: registry_person_del('%s'): deleting person", p->guid);
213 + netdata_log_debug(D_REGISTRY, "Registry: registry_person_del('%s'): deleting person", p->guid);
214
215 while(p->person_urls)
216 registry_person_unlink_from_url(p, (REGISTRY_PERSON_URL *)p->person_urls);
@@ -218,7 +218,7 @@ static int registry_person_del_callback(const DICTIONARY_ITEM *item __maybe_unus
218 //debug(D_REGISTRY, "Registry: deleting person '%s' from persons registry", p->guid);
219 //dictionary_del(registry.persons, p->guid);
220
221 - debug(D_REGISTRY, "Registry: freeing person '%s'", p->guid);
221 + netdata_log_debug(D_REGISTRY, "Registry: freeing person '%s'", p->guid);
222 freez(p);
223
224 return 1;
@@ -227,12 +227,12 @@ static int registry_person_del_callback(const DICTIONARY_ITEM *item __maybe_unus
227 void registry_free(void) {
228 if(!registry.enabled) return;
229
230 - debug(D_REGISTRY, "Registry: destroying persons dictionary");
230 + netdata_log_debug(D_REGISTRY, "Registry: destroying persons dictionary");
231 dictionary_walkthrough_read(registry.persons, registry_person_del_callback, NULL);
232 dictionary_destroy(registry.persons);
233 registry.persons = NULL;
234
235 - debug(D_REGISTRY, "Registry: destroying machines dictionary");
235 + netdata_log_debug(D_REGISTRY, "Registry: destroying machines dictionary");
236 dictionary_walkthrough_read(registry.machines, machine_delete_callback, NULL);
237 dictionary_destroy(registry.machines);
238 registry.machines = NULL;
registry/registry_internals.c
+1 -1
@@ -142,7 +142,7 @@ REGISTRY_PERSON_URL *registry_verify_request(const char *person_guid, char *mach
142 // REGISTRY REQUESTS
143
144 REGISTRY_PERSON *registry_request_access(const char *person_guid, char *machine_guid, char *url, char *name, time_t when) {
145 - debug(D_REGISTRY, "registry_request_access('%s', '%s', '%s'): NEW REQUEST", (person_guid)?person_guid:"", machine_guid, url);
145 + netdata_log_debug(D_REGISTRY, "registry_request_access('%s', '%s', '%s'): NEW REQUEST", (person_guid)?person_guid:"", machine_guid, url);
146
147 bool is_dummy = is_dummy_person(person_guid);
148
registry/registry_log.c
+1 -1
@@ -70,7 +70,7 @@ ssize_t registry_log_load(void) {
70 // otherwise we will append to it the values we read
71 registry_log_close();
72
73 - debug(D_REGISTRY, "Registry: loading active db from: %s", registry.log_filename);
73 + netdata_log_debug(D_REGISTRY, "Registry: loading active db from: %s", registry.log_filename);
74 FILE *fp = fopen(registry.log_filename, "r");
75 if(!fp)
76 netdata_log_error("Registry: cannot open registry file: %s", registry.log_filename);
registry/registry_machine.c
+8 -8
@@ -7,7 +7,7 @@
7 // MACHINE
8
9 REGISTRY_MACHINE *registry_machine_find(const char *machine_guid) {
10 - debug(D_REGISTRY, "REGISTRY: registry_machine_find('%s')", machine_guid);
10 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_find('%s')", machine_guid);
11 return dictionary_get(registry.machines, machine_guid);
12 }
13
@@ -28,7 +28,7 @@ void registry_machine_url_unlink_from_machine_and_free(REGISTRY_MACHINE *m, REGI
28 }
29
30 REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, STRING *u, time_t when) {
31 - debug(D_REGISTRY, "REGISTRY: registry_machine_url_allocate('%s', '%s'): allocating %zu bytes", m->guid, string2str(u), sizeof(REGISTRY_MACHINE_URL));
31 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_url_allocate('%s', '%s'): allocating %zu bytes", m->guid, string2str(u), sizeof(REGISTRY_MACHINE_URL));
32
33 REGISTRY_MACHINE_URL *mu = aral_mallocz(registry.machine_urls_aral);
34
@@ -37,7 +37,7 @@ REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, STRING
37 mu->url = string_dup(u);
38 mu->flags = REGISTRY_URL_FLAGS_DEFAULT;
39
40 - debug(D_REGISTRY, "REGISTRY: registry_machine_url_allocate('%s', '%s'): indexing URL in machine", m->guid, string2str(u));
40 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_url_allocate('%s', '%s'): indexing URL in machine", m->guid, string2str(u));
41
42 DOUBLE_LINKED_LIST_PREPEND_ITEM_UNSAFE(m->machine_urls, mu, prev, next);
43
@@ -45,7 +45,7 @@ REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, STRING
45 }
46
47 REGISTRY_MACHINE *registry_machine_allocate(const char *machine_guid, time_t when) {
48 - debug(D_REGISTRY, "REGISTRY: registry_machine_allocate('%s'): creating new machine, sizeof(MACHINE)=%zu", machine_guid, sizeof(REGISTRY_MACHINE));
48 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_allocate('%s'): creating new machine, sizeof(MACHINE)=%zu", machine_guid, sizeof(REGISTRY_MACHINE));
49
50 REGISTRY_MACHINE *m = aral_mallocz(registry.machines_aral);
51
@@ -89,16 +89,16 @@ REGISTRY_MACHINE *registry_machine_find_or_create(const char *machine_guid, time
89 // LINKING OF OBJECTS
90
91 REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, STRING *url, time_t when) {
92 - debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): searching for URL in machine", m->guid, string2str(url));
92 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): searching for URL in machine", m->guid, string2str(url));
93
94 REGISTRY_MACHINE_URL *mu = registry_machine_url_find(m, url);
95 if(!mu) {
96 - debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): not found", m->guid, string2str(url));
96 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): not found", m->guid, string2str(url));
97 mu = registry_machine_url_allocate(m, url, when);
98 registry.machines_urls_count++;
99 }
100 else {
101 - debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): found", m->guid, string2str(url));
101 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): found", m->guid, string2str(url));
102 mu->usages++;
103 if(likely(mu->last_t < (uint32_t)when)) mu->last_t = (uint32_t)when;
104 }
@@ -107,7 +107,7 @@ REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, STRING *
107 if(likely(m->last_t < (uint32_t)when)) m->last_t = (uint32_t)when;
108
109 if(mu->flags & REGISTRY_URL_FLAGS_EXPIRED) {
110 - debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): accessing an expired URL.", m->guid, string2str(url));
110 + netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): accessing an expired URL.", m->guid, string2str(url));
111 mu->flags &= ~REGISTRY_URL_FLAGS_EXPIRED;
112 }
113
registry/registry_person.c
+16 -16
@@ -7,7 +7,7 @@
7 // PERSON_URL INDEX
8
9 inline REGISTRY_PERSON_URL *registry_person_url_index_find(REGISTRY_PERSON *p, STRING *url) {
10 - debug(D_REGISTRY, "Registry: registry_person_url_index_find('%s', '%s')", p->guid, string2str(url));
10 + netdata_log_debug(D_REGISTRY, "Registry: registry_person_url_index_find('%s', '%s')", p->guid, string2str(url));
11
12 REGISTRY_PERSON_URL *pu;
13 for(pu = p->person_urls ; pu ;pu = pu->next)
@@ -31,7 +31,7 @@ inline REGISTRY_PERSON_URL *registry_person_url_index_del(REGISTRY_PERSON *p, RE
31 // PERSON_URL
32
33 REGISTRY_PERSON_URL *registry_person_url_allocate(REGISTRY_PERSON *p, REGISTRY_MACHINE *m, STRING *url, char *machine_name, size_t machine_name_len, time_t when) {
34 - debug(D_REGISTRY, "registry_person_url_allocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, string2str(url), sizeof(REGISTRY_PERSON_URL) + machine_name_len);
34 + netdata_log_debug(D_REGISTRY, "registry_person_url_allocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, string2str(url), sizeof(REGISTRY_PERSON_URL) + machine_name_len);
35
36 // protection from too big names
37 if(machine_name_len > registry.max_name_length)
@@ -50,7 +50,7 @@ REGISTRY_PERSON_URL *registry_person_url_allocate(REGISTRY_PERSON *p, REGISTRY_M
50 pu->flags = REGISTRY_URL_FLAGS_DEFAULT;
51 m->links++;
52
53 - debug(D_REGISTRY, "registry_person_url_allocate('%s', '%s', '%s'): indexing URL in person", p->guid, m->guid, string2str(url));
53 + netdata_log_debug(D_REGISTRY, "registry_person_url_allocate('%s', '%s', '%s'): indexing URL in person", p->guid, m->guid, string2str(url));
54 REGISTRY_PERSON_URL *tpu = registry_person_url_index_add(p, pu);
55 if(tpu != pu) {
56 netdata_log_error("Registry: Attempted to add duplicate person url '%s' with name '%s' to person '%s'", string2str(url), machine_name, p->guid);
@@ -64,7 +64,7 @@ REGISTRY_PERSON_URL *registry_person_url_allocate(REGISTRY_PERSON *p, REGISTRY_M
64 }
65
66 void registry_person_url_deindex_and_free(REGISTRY_PERSON *p, REGISTRY_PERSON_URL *pu) {
67 - debug(D_REGISTRY, "registry_person_url_deindex_and_free('%s', '%s')", p->guid, string2str(pu->url));
67 + netdata_log_debug(D_REGISTRY, "registry_person_url_deindex_and_free('%s', '%s')", p->guid, string2str(pu->url));
68
69 REGISTRY_PERSON_URL *tpu = registry_person_url_index_del(p, pu);
70 if(tpu) {
@@ -77,7 +77,7 @@ void registry_person_url_deindex_and_free(REGISTRY_PERSON *p, REGISTRY_PERSON_UR
77
78 // this function is needed to change the name of a PERSON_URL
79 REGISTRY_PERSON_URL *registry_person_url_reallocate(REGISTRY_PERSON *p, REGISTRY_MACHINE *m, STRING *url, char *machine_name, size_t machine_name_len, time_t when, REGISTRY_PERSON_URL *pu) {
80 - debug(D_REGISTRY, "registry_person_url_reallocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, string2str(url), sizeof(REGISTRY_PERSON_URL) + machine_name_len);
80 + netdata_log_debug(D_REGISTRY, "registry_person_url_reallocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, string2str(url), sizeof(REGISTRY_PERSON_URL) + machine_name_len);
81
82 // keep a backup
83 REGISTRY_PERSON_URL pu2 = {
@@ -108,12 +108,12 @@ REGISTRY_PERSON_URL *registry_person_url_reallocate(REGISTRY_PERSON *p, REGISTRY
108 // PERSON
109
110 REGISTRY_PERSON *registry_person_find(const char *person_guid) {
111 - debug(D_REGISTRY, "Registry: registry_person_find('%s')", person_guid);
111 + netdata_log_debug(D_REGISTRY, "Registry: registry_person_find('%s')", person_guid);
112 return dictionary_get(registry.persons, person_guid);
113 }
114
115 REGISTRY_PERSON *registry_person_allocate(const char *person_guid, time_t when) {
116 - debug(D_REGISTRY, "Registry: registry_person_allocate('%s'): allocating new person, sizeof(PERSON)=%zu", (person_guid)?person_guid:"", sizeof(REGISTRY_PERSON));
116 + netdata_log_debug(D_REGISTRY, "Registry: registry_person_allocate('%s'): allocating new person, sizeof(PERSON)=%zu", (person_guid)?person_guid:"", sizeof(REGISTRY_PERSON));
117
118 REGISTRY_PERSON *p = aral_mallocz(registry.persons_aral);
119 if(!person_guid) {
@@ -122,9 +122,9 @@ REGISTRY_PERSON *registry_person_allocate(const char *person_guid, time_t when)
122 uuid_generate(uuid);
123 uuid_unparse_lower(uuid, p->guid);
124
125 - debug(D_REGISTRY, "Registry: Checking if the generated person guid '%s' is unique", p->guid);
125 + netdata_log_debug(D_REGISTRY, "Registry: Checking if the generated person guid '%s' is unique", p->guid);
126 if (!dictionary_get(registry.persons, p->guid)) {
127 - debug(D_REGISTRY, "Registry: generated person guid '%s' is unique", p->guid);
127 + netdata_log_debug(D_REGISTRY, "Registry: generated person guid '%s' is unique", p->guid);
128 break;
129 }
130 else
@@ -151,7 +151,7 @@ REGISTRY_PERSON *registry_person_allocate(const char *person_guid, time_t when)
151 // 3. if it is not valid, create a new one
152 // 4. return it
153 REGISTRY_PERSON *registry_person_find_or_create(const char *person_guid, time_t when, bool is_dummy) {
154 - debug(D_REGISTRY, "Registry: registry_person_find_or_create('%s'): creating dictionary of urls", person_guid);
154 + netdata_log_debug(D_REGISTRY, "Registry: registry_person_find_or_create('%s'): creating dictionary of urls", person_guid);
155
156 char buf[GUID_LEN + 1];
157 REGISTRY_PERSON *p = NULL;
@@ -181,28 +181,28 @@ REGISTRY_PERSON *registry_person_find_or_create(const char *person_guid, time_t
181 // LINKING OF OBJECTS
182
183 REGISTRY_PERSON_URL *registry_person_link_to_url(REGISTRY_PERSON *p, REGISTRY_MACHINE *m, STRING *url, char *machine_name, size_t machine_name_len, time_t when) {
184 - debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): searching for URL in person", p->guid, m->guid, string2str(url));
184 + netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): searching for URL in person", p->guid, m->guid, string2str(url));
185
186 REGISTRY_PERSON_URL *pu = registry_person_url_index_find(p, url);
187 if(!pu) {
188 - debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): not found", p->guid, m->guid, string2str(url));
188 + netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): not found", p->guid, m->guid, string2str(url));
189 pu = registry_person_url_allocate(p, m, url, machine_name, machine_name_len, when);
190 registry.persons_urls_count++;
191 }
192 else {
193 - debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): found", p->guid, m->guid, string2str(url));
193 + netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): found", p->guid, m->guid, string2str(url));
194 pu->usages++;
195 if(likely(pu->last_t < (uint32_t)when)) pu->last_t = (uint32_t)when;
196
197 if(pu->machine != m) {
198 REGISTRY_MACHINE_URL *mu = registry_machine_url_find(pu->machine, url);
199 if(mu) {
200 - debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): URL switched machines (old was '%s') - expiring it from previous machine.",
200 + netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): URL switched machines (old was '%s') - expiring it from previous machine.",
201 p->guid, m->guid, string2str(url), pu->machine->guid);
202 mu->flags |= REGISTRY_URL_FLAGS_EXPIRED;
203 }
204 else {
205 - debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): URL switched machines (old was '%s') - but the URL is not linked to the old machine.",
205 + netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): URL switched machines (old was '%s') - but the URL is not linked to the old machine.",
206 p->guid, m->guid, string2str(url), pu->machine->guid);
207 }
208
@@ -220,7 +220,7 @@ REGISTRY_PERSON_URL *registry_person_link_to_url(REGISTRY_PERSON *p, REGISTRY_MA
220 if(likely(p->last_t < (uint32_t)when)) p->last_t = (uint32_t)when;
221
222 if(pu->flags & REGISTRY_URL_FLAGS_EXPIRED) {
223 - debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): accessing an expired URL. Re-enabling URL.", p->guid, m->guid, string2str(url));
223 + netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): accessing an expired URL. Re-enabling URL.", p->guid, m->guid, string2str(url));
224 pu->flags &= ~REGISTRY_URL_FLAGS_EXPIRED;
225 }
226
streaming/compression.c
+1 -1
@@ -96,7 +96,7 @@ size_t rrdpush_compress(struct compressor_state *state, const char *data, size_t
96 uint32_t len = ((compressed_data_size & 0x7f) | 0x80 | (((compressed_data_size & (0x7f << 7)) << 1) | 0x8000)) << 8;
97 *(uint32_t *)state->compression_result_buffer = len | RRDPUSH_COMPRESSION_SIGNATURE;
98 *out = state->compression_result_buffer;
99 - debug(D_STREAM, "%s: Compressed data header: %ld", STREAM_COMPRESSION_MSG, compressed_data_size);
99 + netdata_log_debug(D_STREAM, "%s: Compressed data header: %ld", STREAM_COMPRESSION_MSG, compressed_data_size);
100 return compressed_data_size + RRDPUSH_COMPRESSION_SIGNATURE_SIZE;
101 }
102
streaming/receiver.c
+1 -1
@@ -734,7 +734,7 @@ static void rrdpush_receive(struct receiver_state *rpt)
734 sprintf(initial_response, "%s", START_STREAMING_PROMPT_V1);
735 }
736
737 - debug(D_STREAM, "Initial response to %s: %s", rpt->client_ip, initial_response);
737 + netdata_log_debug(D_STREAM, "Initial response to %s: %s", rpt->client_ip, initial_response);
738 ssize_t bytes_sent = send_timeout(
739 #ifdef ENABLE_HTTPS
740 &rpt->ssl,
streaming/rrdpush.c
+1 -1
@@ -1185,7 +1185,7 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *decoded_query_stri
1185 }
1186 }
1187
1188 - debug(D_SYSTEM, "starting STREAM receive thread.");
1188 + netdata_log_debug(D_SYSTEM, "starting STREAM receive thread.");
1189
1190 rrdpush_receiver_takeover_web_connection(w, rpt);
1191
streaming/sender.c
+12 -12
@@ -203,7 +203,7 @@ static inline void rrdpush_sender_add_host_variable_to_buffer(BUFFER *wb, const
203 , rrdvar2number(rva)
204 );
205
206 - debug(D_STREAM, "RRDVAR pushed HOST VARIABLE %s = " NETDATA_DOUBLE_FORMAT, rrdvar_name(rva), rrdvar2number(rva));
206 + netdata_log_debug(D_STREAM, "RRDVAR pushed HOST VARIABLE %s = " NETDATA_DOUBLE_FORMAT, rrdvar_name(rva), rrdvar2number(rva));
207 }
208
209 void rrdpush_sender_send_this_host_variable_now(RRDHOST *host, const RRDVAR_ACQUIRED *rva) {
@@ -242,7 +242,7 @@ static void rrdpush_sender_thread_send_custom_host_variables(RRDHOST *host) {
242 sender_commit(host->sender, wb, STREAM_TRAFFIC_TYPE_METADATA);
243 sender_thread_buffer_free();
244
245 - debug(D_STREAM, "RRDVAR sent %d VARIABLES", ret);
245 + netdata_log_debug(D_STREAM, "RRDVAR sent %d VARIABLES", ret);
246 }
247 }
248
@@ -752,7 +752,7 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p
752 netdata_log_error("STREAM %s [send to %s]: cannot enlarge the socket buffer.", rrdhost_hostname(host), s->connected_to);
753
754 http[bytes] = '\0';
755 - debug(D_STREAM, "Response to sender from far end: %s", http);
755 + netdata_log_debug(D_STREAM, "Response to sender from far end: %s", http);
756 if(!rrdpush_sender_validate_response(host, s, http, bytes))
757 return false;
758
@@ -765,7 +765,7 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p
765
766 log_sender_capabilities(s);
767
768 - debug(D_STREAM, "STREAM: Connected on fd %d...", s->rrdpush_sender_socket);
768 + netdata_log_debug(D_STREAM, "STREAM: Connected on fd %d...", s->rrdpush_sender_socket);
769
770 return true;
771 }
@@ -824,7 +824,7 @@ static ssize_t attempt_to_send(struct sender_state *s) {
824 sender_lock(s);
825 char *chunk;
826 size_t outstanding = cbuffer_next_unsafe(s->buffer, &chunk);
827 - debug(D_STREAM, "STREAM: Sending data. Buffer r=%zu w=%zu s=%zu, next chunk=%zu", cb->read, cb->write, cb->size, outstanding);
827 + netdata_log_debug(D_STREAM, "STREAM: Sending data. Buffer r=%zu w=%zu s=%zu, next chunk=%zu", cb->read, cb->write, cb->size, outstanding);
828
829 #ifdef ENABLE_HTTPS
830 if(SSL_connection(&s->ssl))
@@ -839,18 +839,18 @@ static ssize_t attempt_to_send(struct sender_state *s) {
839 cbuffer_remove_unsafe(s->buffer, ret);
840 s->sent_bytes_on_this_connection += ret;
841 s->sent_bytes += ret;
842 - debug(D_STREAM, "STREAM %s [send to %s]: Sent %zd bytes", rrdhost_hostname(s->host), s->connected_to, ret);
842 + netdata_log_debug(D_STREAM, "STREAM %s [send to %s]: Sent %zd bytes", rrdhost_hostname(s->host), s->connected_to, ret);
843 }
844 else if (ret == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK))
845 - debug(D_STREAM, "STREAM %s [send to %s]: unavailable after polling POLLOUT", rrdhost_hostname(s->host), s->connected_to);
845 + netdata_log_debug(D_STREAM, "STREAM %s [send to %s]: unavailable after polling POLLOUT", rrdhost_hostname(s->host), s->connected_to);
846 else if (ret == -1) {
847 worker_is_busy(WORKER_SENDER_JOB_DISCONNECT_SEND_ERROR);
848 - debug(D_STREAM, "STREAM: Send failed - closing socket...");
848 + netdata_log_debug(D_STREAM, "STREAM: Send failed - closing socket...");
849 netdata_log_error("STREAM %s [send to %s]: failed to send metrics - closing connection - we have sent %zu bytes on this connection.", rrdhost_hostname(s->host), s->connected_to, s->sent_bytes_on_this_connection);
850 rrdpush_sender_thread_close_socket(s->host);
851 }
852 else
853 - debug(D_STREAM, "STREAM: send() returned 0 -> no error but no transmission");
853 + netdata_log_debug(D_STREAM, "STREAM: send() returned 0 -> no error but no transmission");
854
855 replication_recalculate_buffer_used_ratio_unsafe(s);
856 sender_unlock(s);
@@ -1388,7 +1388,7 @@ void *rrdpush_sender_thread(void *ptr) {
1388
1389 int poll_rc = poll(fds, 2, 1000);
1390
1391 - debug(D_STREAM, "STREAM: poll() finished collector=%d socket=%d (current chunk %zu bytes)...",
1391 + netdata_log_debug(D_STREAM, "STREAM: poll() finished collector=%d socket=%d (current chunk %zu bytes)...",
1392 fds[Collector].revents, fds[Socket].revents, outstanding);
1393
1394 if(unlikely(rrdhost_sender_should_exit(s)))
@@ -1403,7 +1403,7 @@ void *rrdpush_sender_thread(void *ptr) {
1403 // Spurious wake-ups without error - loop again
1404 if (poll_rc == 0 || ((poll_rc == -1) && (errno == EAGAIN || errno == EINTR))) {
1405 netdata_thread_testcancel();
1406 - debug(D_STREAM, "Spurious wakeup");
1406 + netdata_log_debug(D_STREAM, "Spurious wakeup");
1407 now_s = now_monotonic_sec();
1408 continue;
1409 }
@@ -1430,7 +1430,7 @@ void *rrdpush_sender_thread(void *ptr) {
1430 // If the collector woke us up then empty the pipe to remove the signal
1431 if (fds[Collector].revents & (POLLIN|POLLPRI)) {
1432 worker_is_busy(WORKER_SENDER_JOB_PIPE_READ);
1433 - debug(D_STREAM, "STREAM: Data added to send buffer (current buffer chunk %zu bytes)...", outstanding);
1433 + netdata_log_debug(D_STREAM, "STREAM: Data added to send buffer (current buffer chunk %zu bytes)...", outstanding);
1434
1435 if (read(fds[Collector].fd, thread_data->pipe_buffer, pipe_buffer_size) == -1)
1436 netdata_log_error("STREAM %s [send to %s]: cannot read from internal pipe.", rrdhost_hostname(s->host), s->connected_to);
tests/profile/benchmark-procfile-parser.c
+14 -14
@@ -17,29 +17,29 @@ extern size_t procfile_max_allocation;
17
18
19 static inline void pflines_reset(pflines *fl) {
20 - // debug(D_PROCFILE, PF_PREFIX ": resetting lines");
20 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting lines");
21
22 fl->len = 0;
23 }
24
25 static inline void pflines_free(pflines *fl) {
26 - // debug(D_PROCFILE, PF_PREFIX ": freeing lines");
26 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": freeing lines");
27
28 freez(fl);
29 }
30
31 static inline void pfwords_reset(pfwords *fw) {
32 - // debug(D_PROCFILE, PF_PREFIX ": resetting words");
32 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting words");
33 fw->len = 0;
34 }
35
36
37 static inline void pfwords_add(procfile *ff, char *str) {
38 - // debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str);
38 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str);
39
40 pfwords *fw = ff->words;
41 if(unlikely(fw->len == fw->size)) {
42 - // debug(D_PROCFILE, PF_PREFIX ": expanding words");
42 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding words");
43
44 ff->words = fw = reallocz(fw, sizeof(pfwords) + (fw->size + PFWORDS_INCREASE_STEP) * sizeof(char *));
45 fw->size += PFWORDS_INCREASE_STEP;
@@ -50,11 +50,11 @@ static inline void pfwords_add(procfile *ff, char *str) {
50
51 NEVERNULL
52 static inline size_t *pflines_add(procfile *ff) {
53 - // debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word);
53 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word);
54
55 pflines *fl = ff->lines;
56 if(unlikely(fl->len == fl->size)) {
57 - // debug(D_PROCFILE, PF_PREFIX ": expanding lines");
57 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding lines");
58
59 ff->lines = fl = reallocz(fl, sizeof(pflines) + (fl->size + PFLINES_INCREASE_STEP) * sizeof(ffline));
60 fl->size += PFLINES_INCREASE_STEP;
@@ -70,7 +70,7 @@ static inline size_t *pflines_add(procfile *ff) {
70
71 NOINLINE
72 static void procfile_parser(procfile *ff) {
73 - // debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename);
73 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename);
74
75 char *s = ff->data // our current position
76 , *e = &ff->data[ff->len] // the terminating null
@@ -115,7 +115,7 @@ static void procfile_parser(procfile *ff) {
115 (*line_words)++;
116 t = ++s;
117
118 - // debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words);
118 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words);
119
120 line_words = pflines_add(ff);
121 break;
@@ -190,7 +190,7 @@ static void procfile_parser(procfile *ff) {
190
191
192 procfile *procfile_readall1(procfile *ff) {
193 - // debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename);
193 + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename);
194
195 ff->len = 0; // zero the used size
196 ssize_t r = 1; // read at least once
@@ -199,12 +199,12 @@ procfile *procfile_readall1(procfile *ff) {
199 ssize_t x = ff->size - s;
200
201 if(unlikely(!x)) {
202 - debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s'.", procfile_filename(ff));
202 + netdata_log_debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s'.", procfile_filename(ff));
203 ff = reallocz(ff, sizeof(procfile) + ff->size + PROCFILE_INCREMENT_BUFFER);
204 ff->size += PROCFILE_INCREMENT_BUFFER;
205 }
206
207 - debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
207 + netdata_log_debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
208 r = read(ff->fd, &ff->data[s], ff->size - s);
209 if(unlikely(r == -1)) {
210 if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) netdata_log_error(PF_PREFIX ": Cannot read from file '%s' on fd %d", procfile_filename(ff), ff->fd);
@@ -215,7 +215,7 @@ procfile *procfile_readall1(procfile *ff) {
215 ff->len += r;
216 }
217
218 - // debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
218 + // netdata_log_debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
219 if(unlikely(lseek(ff->fd, 0, SEEK_SET) == -1)) {
220 if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) netdata_log_error(PF_PREFIX ": Cannot rewind on file '%s'.", procfile_filename(ff));
221 procfile_close(ff);
@@ -232,7 +232,7 @@ procfile *procfile_readall1(procfile *ff) {
232 if(unlikely(ff->words->len > procfile_max_words)) procfile_max_words = ff->words->len;
233 }
234
235 - // debug(D_PROCFILE, "File '%s' updated.", ff->filename);
235 + // netdata_log_debug(D_PROCFILE, "File '%s' updated.", ff->filename);
236 return ff;
237 }
238
web/api/badges/web_buffer_svg.c
+2 -2
@@ -905,7 +905,7 @@ int web_client_api_request_v1_badge(RRDHOST *host, struct web_client *w, char *u
905 if(!name || !*name) continue;
906 if(!value || !*value) continue;
907
908 - debug(D_WEB_CLIENT, "%llu: API v1 badge.svg query param '%s' with value '%s'", w->id, name, value);
908 + netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 badge.svg query param '%s' with value '%s'", w->id, name, value);
909
910 // name and value are now the parameters
911 // they are not null and not empty
@@ -1040,7 +1040,7 @@ int web_client_api_request_v1_badge(RRDHOST *host, struct web_client *w, char *u
1040 units = rrdset_units(st);
1041 }
1042
1043 - debug(D_WEB_CLIENT, "%llu: API command 'badge.svg' for chart '%s', alarm '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%d', options '0x%08x'"
1043 + netdata_log_debug(D_WEB_CLIENT, "%llu: API command 'badge.svg' for chart '%s', alarm '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%d', options '0x%08x'"
1044 , w->id
1045 , chart
1046 , alarm?alarm:""
web/api/health/health_cmdapi.c
+3 -3
@@ -14,7 +14,7 @@
14 void free_silencers(SILENCER *t) {
15 if (!t) return;
16 if (t->next) free_silencers(t->next);
17 - debug(D_HEALTH, "HEALTH command API: Freeing silencer %s:%s:%s:%s:%s", t->alarms,
17 + netdata_log_debug(D_HEALTH, "HEALTH command API: Freeing silencer %s:%s:%s:%s:%s", t->alarms,
18 t->charts, t->contexts, t->hosts, t->families);
19 simple_pattern_free(t->alarms_pattern);
20 simple_pattern_free(t->charts_pattern);
@@ -133,7 +133,7 @@ int web_client_api_request_v1_mgmt_health(RRDHOST *host, struct web_client *w, c
133 buffer_strcat(wb, HEALTH_CMDAPI_MSG_AUTHERROR);
134 ret = HTTP_RESP_FORBIDDEN;
135 } else {
136 - debug(D_HEALTH, "HEALTH command API: Comparing secret '%s' to '%s'", w->auth_bearer_token, api_secret);
136 + netdata_log_debug(D_HEALTH, "HEALTH command API: Comparing secret '%s' to '%s'", w->auth_bearer_token, api_secret);
137 if (strcmp(w->auth_bearer_token, api_secret)) {
138 buffer_strcat(wb, HEALTH_CMDAPI_MSG_AUTHERROR);
139 ret = HTTP_RESP_FORBIDDEN;
@@ -146,7 +146,7 @@ int web_client_api_request_v1_mgmt_health(RRDHOST *host, struct web_client *w, c
146 if (!key || !*key) continue;
147 if (!value || !*value) continue;
148
149 - debug(D_WEB_CLIENT, "%llu: API v1 health query param '%s' with value '%s'", w->id, key, value);
149 + netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 health query param '%s' with value '%s'", w->id, key, value);
150
151 // name and value are now the parameters
152 if (!strcmp(key, "cmd")) {
web/api/web_api_v1.c
+7 -7
@@ -414,7 +414,7 @@ inline int web_client_api_request_v1_alarm_count(RRDHOST *host, struct web_clien
414 if(!name || !*name) continue;
415 if(!value || !*value) continue;
416
417 - debug(D_WEB_CLIENT, "%llu: API v1 alarm_count query param '%s' with value '%s'", w->id, name, value);
417 + netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 alarm_count query param '%s' with value '%s'", w->id, name, value);
418
419 char* p = value;
420 if(!strcmp(name, "status")) {
@@ -654,7 +654,7 @@ inline int web_client_api_request_v1_chart(RRDHOST *host, struct web_client *w,
654
655 // returns the HTTP code
656 static inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, char *url) {
657 - debug(D_WEB_CLIENT, "%llu: API v1 data with URL '%s'", w->id, url);
657 + netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 data with URL '%s'", w->id, url);
658
659 int ret = HTTP_RESP_BAD_REQUEST;
660 BUFFER *dimensions = NULL;
@@ -693,7 +693,7 @@ static inline int web_client_api_request_v1_data(RRDHOST *host, struct web_clien
693 if(!name || !*name) continue;
694 if(!value || !*value) continue;
695
696 - debug(D_WEB_CLIENT, "%llu: API v1 data query param '%s' with value '%s'", w->id, name, value);
696 + netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 data query param '%s' with value '%s'", w->id, name, value);
697
698 // name and value are now the parameters
699 // they are not null and not empty
@@ -839,14 +839,14 @@ static inline int web_client_api_request_v1_data(RRDHOST *host, struct web_clien
839
840 if(outFileName && *outFileName) {
841 buffer_sprintf(w->response.header, "Content-Disposition: attachment; filename=\"%s\"\r\n", outFileName);
842 - debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
842 + netdata_log_debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
843 }
844
845 if(format == DATASOURCE_DATATABLE_JSONP) {
846 if(responseHandler == NULL)
847 responseHandler = "google.visualization.Query.setResponse";
848
849 - debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
849 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
850 w->id, google_version, google_reqId, google_sig, google_out, responseHandler, outFileName
851 );
852
@@ -927,7 +927,7 @@ inline int web_client_api_request_v1_registry(RRDHOST *host, struct web_client *
927 */
928 }
929
930 - debug(D_WEB_CLIENT, "%llu: API v1 registry with URL '%s'", w->id, url);
930 + netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 registry with URL '%s'", w->id, url);
931
932 // TODO
933 // The browser may send multiple cookies with our id
@@ -961,7 +961,7 @@ inline int web_client_api_request_v1_registry(RRDHOST *host, struct web_client *
961 if (!name || !*name) continue;
962 if (!value || !*value) continue;
963
964 - debug(D_WEB_CLIENT, "%llu: API v1 registry query param '%s' with value '%s'", w->id, name, value);
964 + netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 registry query param '%s' with value '%s'", w->id, name, value);
965
966 uint32_t hash = simple_hash(name);
967
web/api/web_api_v2.c
+2 -2
@@ -587,14 +587,14 @@ static int web_client_api_request_v2_data(RRDHOST *host __maybe_unused, struct w
587
588 if(outFileName && *outFileName) {
589 buffer_sprintf(w->response.header, "Content-Disposition: attachment; filename=\"%s\"\r\n", outFileName);
590 - debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
590 + netdata_log_debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
591 }
592
593 if(format == DATASOURCE_DATATABLE_JSONP) {
594 if(responseHandler == NULL)
595 responseHandler = "google.visualization.Query.setResponse";
596
597 - debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
597 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
598 w->id, google_version, google_reqId, google_sig, google_out, responseHandler, outFileName
599 );
600
web/server/static/static-threaded.c
+18 -18
@@ -41,11 +41,11 @@ static struct web_client *web_client_create_on_fd(POLLINFO *pi) {
41
42 int flag = 1;
43 if(unlikely(web_client_check_tcp(w) && setsockopt(w->ifd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)) != 0))
44 - debug(D_WEB_CLIENT, "%llu: failed to enable TCP_NODELAY on socket fd %d.", w->id, w->ifd);
44 + netdata_log_debug(D_WEB_CLIENT, "%llu: failed to enable TCP_NODELAY on socket fd %d.", w->id, w->ifd);
45
46 flag = 1;
47 if(unlikely(setsockopt(w->ifd, SOL_SOCKET, SO_KEEPALIVE, (char *) &flag, sizeof(int)) != 0))
48 - debug(D_WEB_CLIENT, "%llu: failed to enable SO_KEEPALIVE on socket fd %d.", w->id, w->ifd);
48 + netdata_log_debug(D_WEB_CLIENT, "%llu: failed to enable SO_KEEPALIVE on socket fd %d.", w->id, w->ifd);
49
50 web_client_update_acl_matches(w);
51 web_client_enable_wait_receive(w);
@@ -101,7 +101,7 @@ static void *web_server_file_add_callback(POLLINFO *pi, short int *events, void
101
102 worker_private->files_read++;
103
104 - debug(D_WEB_CLIENT, "%llu: ADDED FILE READ ON FD %d", w->id, pi->fd);
104 + netdata_log_debug(D_WEB_CLIENT, "%llu: ADDED FILE READ ON FD %d", w->id, pi->fd);
105 *events = POLLIN;
106 pi->data = w;
107
@@ -111,14 +111,14 @@ static void *web_server_file_add_callback(POLLINFO *pi, short int *events, void
111
112 static void web_server_file_del_callback(POLLINFO *pi) {
113 struct web_client *w = (struct web_client *)pi->data;
114 - debug(D_WEB_CLIENT, "%llu: RELEASE FILE READ ON FD %d", w->id, pi->fd);
114 + netdata_log_debug(D_WEB_CLIENT, "%llu: RELEASE FILE READ ON FD %d", w->id, pi->fd);
115
116 worker_is_busy(WORKER_JOB_DEL_FILE);
117
118 w->pollinfo_filecopy_slot = 0;
119
120 if(unlikely(!w->pollinfo_slot)) {
121 - debug(D_WEB_CLIENT, "%llu: CROSS WEB CLIENT CLEANUP (iFD %d, oFD %d)", w->id, pi->fd, w->ofd);
121 + netdata_log_debug(D_WEB_CLIENT, "%llu: CROSS WEB CLIENT CLEANUP (iFD %d, oFD %d)", w->id, pi->fd, w->ofd);
122 web_server_log_connection(w, "DISCONNECTED");
123 web_client_request_done(w);
124 web_client_release_to_cache(w);
@@ -137,18 +137,18 @@ static int web_server_file_read_callback(POLLINFO *pi, short int *events) {
137 // if there is no POLLINFO linked to this, it means the client disconnected
138 // stop the file reading too
139 if(unlikely(!w->pollinfo_slot)) {
140 - debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON CLOSED WEB CLIENT", w->id, pi->fd);
140 + netdata_log_debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON CLOSED WEB CLIENT", w->id, pi->fd);
141 retval = -1;
142 goto cleanup;
143 }
144
145 if(unlikely(w->mode != WEB_CLIENT_MODE_FILECOPY || w->ifd == w->ofd)) {
146 - debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON NON-FILECOPY WEB CLIENT", w->id, pi->fd);
146 + netdata_log_debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON NON-FILECOPY WEB CLIENT", w->id, pi->fd);
147 retval = -1;
148 goto cleanup;
149 }
150
151 - debug(D_WEB_CLIENT, "%llu: READING FILE ON FD %d", w->id, pi->fd);
151 + netdata_log_debug(D_WEB_CLIENT, "%llu: READING FILE ON FD %d", w->id, pi->fd);
152
153 worker_private->file_reads++;
154 ssize_t ret = unlikely(web_client_read_file(w));
@@ -157,12 +157,12 @@ static int web_server_file_read_callback(POLLINFO *pi, short int *events) {
157 POLLJOB *p = pi->p; // our POLLJOB
158 POLLINFO *wpi = pollinfo_from_slot(p, w->pollinfo_slot); // POLLINFO of the client socket
159
160 - debug(D_WEB_CLIENT, "%llu: SIGNALING W TO SEND (iFD %d, oFD %d)", w->id, pi->fd, wpi->fd);
160 + netdata_log_debug(D_WEB_CLIENT, "%llu: SIGNALING W TO SEND (iFD %d, oFD %d)", w->id, pi->fd, wpi->fd);
161 p->fds[wpi->slot].events |= POLLOUT;
162 }
163
164 if(unlikely(ret <= 0 || w->ifd == w->ofd)) {
165 - debug(D_WEB_CLIENT, "%llu: DONE READING FILE ON FD %d", w->id, pi->fd);
165 + netdata_log_debug(D_WEB_CLIENT, "%llu: DONE READING FILE ON FD %d", w->id, pi->fd);
166 retval = -1;
167 goto cleanup;
168 }
@@ -201,7 +201,7 @@ static void *web_server_add_callback(POLLINFO *pi, short int *events, void *data
201
202 *events = POLLIN;
203
204 - debug(D_WEB_CLIENT_ACCESS, "LISTENER on %d: new connection.", pi->fd);
204 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "LISTENER on %d: new connection.", pi->fd);
205 struct web_client *w = web_client_create_on_fd(pi);
206
207 if (!strncmp(pi->client_port, "UNIX", 4)) {
@@ -240,7 +240,7 @@ static void *web_server_add_callback(POLLINFO *pi, short int *events, void *data
240 }
241 #endif
242
243 - debug(D_WEB_CLIENT, "%llu: ADDED CLIENT FD %d", w->id, pi->fd);
243 + netdata_log_debug(D_WEB_CLIENT, "%llu: ADDED CLIENT FD %d", w->id, pi->fd);
244
245 cleanup:
246 worker_is_idle();
@@ -260,13 +260,13 @@ static void web_server_del_callback(POLLINFO *pi) {
260 POLLINFO *fpi = pollinfo_from_slot(pi->p, w->pollinfo_filecopy_slot); // POLLINFO of the client socket
261 (void)fpi;
262
263 - debug(D_WEB_CLIENT, "%llu: THE CLIENT WILL BE FRED BY READING FILE JOB ON FD %d", w->id, fpi->fd);
263 + netdata_log_debug(D_WEB_CLIENT, "%llu: THE CLIENT WILL BE FRED BY READING FILE JOB ON FD %d", w->id, fpi->fd);
264 }
265 else {
266 if(web_client_flag_check(w, WEB_CLIENT_FLAG_DONT_CLOSE_SOCKET))
267 pi->flags |= POLLINFO_FLAG_DONT_CLOSE;
268
269 - debug(D_WEB_CLIENT, "%llu: CLOSING CLIENT FD %d", w->id, pi->fd);
269 + netdata_log_debug(D_WEB_CLIENT, "%llu: CLOSING CLIENT FD %d", w->id, pi->fd);
270 web_server_log_connection(w, "DISCONNECTED");
271 web_client_request_done(w);
272 web_client_release_to_cache(w);
@@ -289,7 +289,7 @@ static int web_server_rcv_callback(POLLINFO *pi, short int *events) {
289 bytes = web_client_receive(w);
290
291 if (likely(bytes > 0)) {
292 - debug(D_WEB_CLIENT, "%llu: processing received data on fd %d.", w->id, fd);
292 + netdata_log_debug(D_WEB_CLIENT, "%llu: processing received data on fd %d.", w->id, fd);
293 worker_is_idle();
294 worker_is_busy(WORKER_JOB_PROCESS);
295 web_client_process_request(w);
@@ -300,11 +300,11 @@ static int web_server_rcv_callback(POLLINFO *pi, short int *events) {
300
301 else if(unlikely(w->mode == WEB_CLIENT_MODE_FILECOPY)) {
302 if(w->pollinfo_filecopy_slot == 0) {
303 - debug(D_WEB_CLIENT, "%llu: FILECOPY DETECTED ON FD %d", w->id, pi->fd);
303 + netdata_log_debug(D_WEB_CLIENT, "%llu: FILECOPY DETECTED ON FD %d", w->id, pi->fd);
304
305 if (unlikely(w->ifd != -1 && w->ifd != w->ofd && w->ifd != fd)) {
306 // add a new socket to poll_events, with the same
307 - debug(D_WEB_CLIENT, "%llu: CREATING FILECOPY SLOT ON FD %d", w->id, pi->fd);
307 + netdata_log_debug(D_WEB_CLIENT, "%llu: CREATING FILECOPY SLOT ON FD %d", w->id, pi->fd);
308
309 POLLINFO *fpi = poll_add_fd(
310 pi->p
@@ -366,7 +366,7 @@ static int web_server_snd_callback(POLLINFO *pi, short int *events) {
366 struct web_client *w = (struct web_client *)pi->data;
367 int fd = pi->fd;
368
369 - debug(D_WEB_CLIENT, "%llu: sending data on fd %d.", w->id, fd);
369 + netdata_log_debug(D_WEB_CLIENT, "%llu: sending data on fd %d.", w->id, fd);
370
371 int ret = web_client_send(w);
372
web/server/web_client.c
+72 -72
@@ -164,7 +164,7 @@ static void web_client_reset_allocations(struct web_client *w, bool free_all) {
164 void web_client_request_done(struct web_client *w) {
165 web_client_uncork_socket(w);
166
167 - debug(D_WEB_CLIENT, "%llu: Resetting client.", w->id);
167 + netdata_log_debug(D_WEB_CLIENT, "%llu: Resetting client.", w->id);
168
169 if(likely(buffer_strlen(w->url_as_received))) {
170 struct timeval tv;
@@ -233,7 +233,7 @@ void web_client_request_done(struct web_client *w) {
233
234 if(unlikely(w->mode == WEB_CLIENT_MODE_FILECOPY)) {
235 if(w->ifd != w->ofd) {
236 - debug(D_WEB_CLIENT, "%llu: Closing filecopy input file descriptor %d.", w->id, w->ifd);
236 + netdata_log_debug(D_WEB_CLIENT, "%llu: Closing filecopy input file descriptor %d.", w->id, w->ifd);
237
238 if(web_server_mode != WEB_SERVER_MODE_STATIC_THREADED) {
239 if (w->ifd != -1){
@@ -480,7 +480,7 @@ static bool find_filename_to_serve(const char *filename, char *dst, size_t dst_l
480 }
481
482 static int mysendfile(struct web_client *w, char *filename) {
483 - debug(D_WEB_CLIENT, "%llu: Looking for file '%s/%s'", w->id, netdata_configured_web_dir, filename);
483 + netdata_log_debug(D_WEB_CLIENT, "%llu: Looking for file '%s/%s'", w->id, netdata_configured_web_dir, filename);
484
485 if(!web_client_can_access_dashboard(w))
486 return web_client_permission_denied(w);
@@ -492,7 +492,7 @@ static int mysendfile(struct web_client *w, char *filename) {
492 char *s;
493 for(s = filename; *s ;s++) {
494 if( !isalnum(*s) && *s != '/' && *s != '.' && *s != '-' && *s != '_') {
495 - debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not acceptable.", w->id, filename);
495 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not acceptable.", w->id, filename);
496 w->response.data->content_type = CT_TEXT_HTML;
497 buffer_sprintf(w->response.data, "Filename contains invalid characters: ");
498 buffer_strcat_htmlescape(w->response.data, filename);
@@ -502,7 +502,7 @@ static int mysendfile(struct web_client *w, char *filename) {
502
503 // if the filename contains a double dot refuse to serve it
504 if(strstr(filename, "..") != 0) {
505 - debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not acceptable.", w->id, filename);
505 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not acceptable.", w->id, filename);
506 w->response.data->content_type = CT_TEXT_HTML;
507 buffer_strcat(w->response.data, "Relative filenames are not supported: ");
508 buffer_strcat_htmlescape(w->response.data, filename);
@@ -548,7 +548,7 @@ static int mysendfile(struct web_client *w, char *filename) {
548 sock_setnonblock(w->ifd);
549
550 w->response.data->content_type = contenttype_for_filename(web_filename);
551 - debug(D_WEB_CLIENT_ACCESS, "%llu: Sending file '%s' (%"PRId64" bytes, ifd %d, ofd %d).", w->id, web_filename, (int64_t)statbuf.st_size, w->ifd, w->ofd);
551 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Sending file '%s' (%"PRId64" bytes, ifd %d, ofd %d).", w->id, web_filename, (int64_t)statbuf.st_size, w->ifd, w->ofd);
552
553 w->mode = WEB_CLIENT_MODE_FILECOPY;
554 web_client_enable_wait_receive(w);
@@ -569,7 +569,7 @@ static int mysendfile(struct web_client *w, char *filename) {
569
570 void web_client_enable_deflate(struct web_client *w, int gzip) {
571 if(unlikely(w->response.zinitialized)) {
572 - debug(D_DEFLATE, "%llu: Compression has already be initialized for this client.", w->id);
572 + netdata_log_debug(D_DEFLATE, "%llu: Compression has already be initialized for this client.", w->id);
573 return;
574 }
575
@@ -610,7 +610,7 @@ void web_client_enable_deflate(struct web_client *w, int gzip) {
610 w->response.zinitialized = true;
611 w->flags |= WEB_CLIENT_CHUNKED_TRANSFER;
612
613 - debug(D_DEFLATE, "%llu: Initialized compression.", w->id);
613 + netdata_log_debug(D_DEFLATE, "%llu: Initialized compression.", w->id);
614 }
615
616 void buffer_data_options2string(BUFFER *wb, uint32_t options) {
@@ -711,7 +711,7 @@ int web_client_api_request(RRDHOST *host, struct web_client *w, char *url_path_f
711 // get the api version
712 char *tok = strsep_skip_consecutive_separators(&url_path_fragment, "/");
713 if(tok && *tok) {
714 - debug(D_WEB_CLIENT, "%llu: Searching for API version '%s'.", w->id, tok);
714 + netdata_log_debug(D_WEB_CLIENT, "%llu: Searching for API version '%s'.", w->id, tok);
715 if(strcmp(tok, "v2") == 0)
716 return web_client_api_request_v2(host, w, url_path_fragment);
717 else if(strcmp(tok, "v1") == 0)
@@ -1161,7 +1161,7 @@ void web_client_build_http_header(struct web_client *w) {
1161 }
1162
1163 // prepare the HTTP response header
1164 - debug(D_WEB_CLIENT, "%llu: Generating HTTP header with response %d.", w->id, w->response.code);
1164 + netdata_log_debug(D_WEB_CLIENT, "%llu: Generating HTTP header with response %d.", w->id, w->response.code);
1165
1166 const char *content_type_string = web_content_type_to_string(w->response.data->content_type);
1167 const char *code_msg = web_response_code_to_string(w->response.code);
@@ -1268,7 +1268,7 @@ static inline void web_client_send_http_header(struct web_client *w) {
1268 web_client_build_http_header(w);
1269
1270 // sent the HTTP header
1271 - debug(D_WEB_DATA, "%llu: Sending response HTTP header of size %zu: '%s'"
1271 + netdata_log_debug(D_WEB_DATA, "%llu: Sending response HTTP header of size %zu: '%s'"
1272 , w->id
1273 , buffer_strlen(w->response.header_output)
1274 , buffer_tostring(w->response.header_output)
@@ -1348,7 +1348,7 @@ static inline int web_client_switch_host(RRDHOST *host, struct web_client *w, ch
1348
1349 char *tok = strsep_skip_consecutive_separators(&url, "/");
1350 if(tok && *tok) {
1351 - debug(D_WEB_CLIENT, "%llu: Searching for host with name '%s'.", w->id, tok);
1351 + netdata_log_debug(D_WEB_CLIENT, "%llu: Searching for host with name '%s'.", w->id, tok);
1352
1353 if(nodeid) {
1354 host = find_host_by_node_id(tok);
@@ -1420,12 +1420,12 @@ int web_client_api_request_with_node_selection(RRDHOST *host, struct web_client
1420
1421 if(unlikely(hash == hash_api && strcmp(tok, "api") == 0)) {
1422 // current API
1423 - debug(D_WEB_CLIENT_ACCESS, "%llu: API request ...", w->id);
1423 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: API request ...", w->id);
1424 return check_host_and_call(host, w, decoded_url_path, web_client_api_request);
1425 }
1426 else if(unlikely((hash == hash_host && strcmp(tok, "host") == 0) || (hash == hash_node && strcmp(tok, "node") == 0))) {
1427 // host switching
1428 - debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
1428 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
1429 return web_client_switch_host(host, w, decoded_url_path, hash == hash_node, web_client_api_request_with_node_selection);
1430 }
1431 }
@@ -1475,14 +1475,14 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1475 char *tok = strsep_skip_consecutive_separators(&decoded_url_path, "/?");
1476 if(likely(tok && *tok)) {
1477 uint32_t hash = simple_hash(tok);
1478 - debug(D_WEB_CLIENT, "%llu: Processing command '%s'.", w->id, tok);
1478 + netdata_log_debug(D_WEB_CLIENT, "%llu: Processing command '%s'.", w->id, tok);
1479
1480 if(likely(hash == hash_api && strcmp(tok, "api") == 0)) { // current API
1481 - debug(D_WEB_CLIENT_ACCESS, "%llu: API request ...", w->id);
1481 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: API request ...", w->id);
1482 return check_host_and_call(host, w, decoded_url_path, web_client_api_request);
1483 }
1484 else if(unlikely((hash == hash_host && strcmp(tok, "host") == 0) || (hash == hash_node && strcmp(tok, "node") == 0))) { // host switching
1485 - debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
1485 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
1486 return web_client_switch_host(host, w, decoded_url_path, hash == hash_node, web_client_process_url);
1487 }
1488 else if(unlikely(hash == hash_v2 && strcmp(tok, "v2") == 0)) {
@@ -1507,7 +1507,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1507 if(unlikely(!web_client_can_access_netdataconf(w)))
1508 return web_client_permission_denied(w);
1509
1510 - debug(D_WEB_CLIENT_ACCESS, "%llu: generating netdata.conf ...", w->id);
1510 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: generating netdata.conf ...", w->id);
1511 w->response.data->content_type = CT_TEXT_PLAIN;
1512 buffer_flush(w->response.data);
1513 config_generate(w->response.data, 0);
@@ -1539,7 +1539,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1539 // get the name of the data to show
1540 tok = strsep_skip_consecutive_separators(&decoded_url_path, "&");
1541 if(tok && *tok) {
1542 - debug(D_WEB_CLIENT, "%llu: Searching for RRD data with name '%s'.", w->id, tok);
1542 + netdata_log_debug(D_WEB_CLIENT, "%llu: Searching for RRD data with name '%s'.", w->id, tok);
1543
1544 // do we have such a data set?
1545 RRDSET *st = rrdset_find_byname(host, tok);
@@ -1548,7 +1548,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1548 w->response.data->content_type = CT_TEXT_HTML;
1549 buffer_strcat(w->response.data, "Chart is not found: ");
1550 buffer_strcat_htmlescape(w->response.data, tok);
1551 - debug(D_WEB_CLIENT_ACCESS, "%llu: %s is not found.", w->id, tok);
1551 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: %s is not found.", w->id, tok);
1552 return HTTP_RESP_NOT_FOUND;
1553 }
1554
@@ -1562,7 +1562,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1562 w->response.data->content_type = CT_TEXT_HTML;
1563 buffer_sprintf(w->response.data, "Chart has now debug %s: ", rrdset_flag_check(st, RRDSET_FLAG_DEBUG)?"enabled":"disabled");
1564 buffer_strcat_htmlescape(w->response.data, tok);
1565 - debug(D_WEB_CLIENT_ACCESS, "%llu: debug for %s is %s.", w->id, tok, rrdset_flag_check(st, RRDSET_FLAG_DEBUG)?"enabled":"disabled");
1565 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: debug for %s is %s.", w->id, tok, rrdset_flag_check(st, RRDSET_FLAG_DEBUG)?"enabled":"disabled");
1566 return HTTP_RESP_OK;
1567 }
1568
@@ -1574,7 +1574,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1574 if(unlikely(!web_client_can_access_netdataconf(w)))
1575 return web_client_permission_denied(w);
1576
1577 - debug(D_WEB_CLIENT_ACCESS, "%llu: Mirroring...", w->id);
1577 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Mirroring...", w->id);
1578
1579 // replace the zero bytes with spaces
1580 buffer_char_replace(w->response.data, '\0', ' ');
@@ -1676,7 +1676,7 @@ void web_client_process_request(struct web_client *w) {
1676 buffer_flush(w->url_as_received);
1677 buffer_strcat(w->url_as_received, "too big request");
1678
1679 - debug(D_WEB_CLIENT_ACCESS, "%llu: Received request is too big (%zu bytes).", w->id, w->response.data->len);
1679 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Received request is too big (%zu bytes).", w->id, w->response.data->len);
1680
1681 size_t len = w->response.data->len;
1682 buffer_flush(w->response.data);
@@ -1710,28 +1710,28 @@ void web_client_process_request(struct web_client *w) {
1710 }
1711 #endif
1712 case HTTP_VALIDATION_MALFORMED_URL:
1713 - debug(D_WEB_CLIENT_ACCESS, "%llu: Malformed URL '%s'.", w->id, w->response.data->buffer);
1713 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Malformed URL '%s'.", w->id, w->response.data->buffer);
1714
1715 buffer_flush(w->response.data);
1716 buffer_strcat(w->response.data, "Malformed URL...\r\n");
1717 w->response.code = HTTP_RESP_BAD_REQUEST;
1718 break;
1719 case HTTP_VALIDATION_EXCESS_REQUEST_DATA:
1720 - debug(D_WEB_CLIENT_ACCESS, "%llu: Excess data in request '%s'.", w->id, w->response.data->buffer);
1720 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Excess data in request '%s'.", w->id, w->response.data->buffer);
1721
1722 buffer_flush(w->response.data);
1723 buffer_strcat(w->response.data, "Excess data in request.\r\n");
1724 w->response.code = HTTP_RESP_BAD_REQUEST;
1725 break;
1726 case HTTP_VALIDATION_TOO_MANY_READ_RETRIES:
1727 - debug(D_WEB_CLIENT_ACCESS, "%llu: Too many retries to read request '%s'.", w->id, w->response.data->buffer);
1727 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Too many retries to read request '%s'.", w->id, w->response.data->buffer);
1728
1729 buffer_flush(w->response.data);
1730 buffer_strcat(w->response.data, "Too many retries to read request.\r\n");
1731 w->response.code = HTTP_RESP_BAD_REQUEST;
1732 break;
1733 case HTTP_VALIDATION_NOT_SUPPORTED:
1734 - debug(D_WEB_CLIENT_ACCESS, "%llu: HTTP method requested is not supported '%s'.", w->id, w->response.data->buffer);
1734 + netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: HTTP method requested is not supported '%s'.", w->id, w->response.data->buffer);
1735
1736 buffer_flush(w->response.data);
1737 buffer_strcat(w->response.data, "HTTP method requested is not supported...\r\n");
@@ -1756,21 +1756,21 @@ void web_client_process_request(struct web_client *w) {
1756
1757 switch(w->mode) {
1758 case WEB_CLIENT_MODE_STREAM:
1759 - debug(D_WEB_CLIENT, "%llu: STREAM done.", w->id);
1759 + netdata_log_debug(D_WEB_CLIENT, "%llu: STREAM done.", w->id);
1760 break;
1761
1762 case WEB_CLIENT_MODE_OPTIONS:
1763 - debug(D_WEB_CLIENT, "%llu: Done preparing the OPTIONS response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
1763 + netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the OPTIONS response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
1764 break;
1765
1766 case WEB_CLIENT_MODE_POST:
1767 case WEB_CLIENT_MODE_GET:
1768 - debug(D_WEB_CLIENT, "%llu: Done preparing the response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
1768 + netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
1769 break;
1770
1771 case WEB_CLIENT_MODE_FILECOPY:
1772 if(w->response.rlen) {
1773 - debug(D_WEB_CLIENT, "%llu: Done preparing the response. Will be sending data file of %zu bytes to client.", w->id, w->response.rlen);
1773 + netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the response. Will be sending data file of %zu bytes to client.", w->id, w->response.rlen);
1774 web_client_enable_wait_receive(w);
1775
1776 /*
@@ -1787,7 +1787,7 @@ void web_client_process_request(struct web_client *w) {
1787 */
1788 }
1789 else
1790 - debug(D_WEB_CLIENT, "%llu: Done preparing the response. Will be sending an unknown amount of bytes to client.", w->id);
1790 + netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the response. Will be sending an unknown amount of bytes to client.", w->id);
1791 break;
1792
1793 default:
@@ -1798,7 +1798,7 @@ void web_client_process_request(struct web_client *w) {
1798
1799 ssize_t web_client_send_chunk_header(struct web_client *w, size_t len)
1800 {
1801 - debug(D_DEFLATE, "%llu: OPEN CHUNK of %zu bytes (hex: %zx).", w->id, len, len);
1801 + netdata_log_debug(D_DEFLATE, "%llu: OPEN CHUNK of %zu bytes (hex: %zx).", w->id, len, len);
1802 char buf[24];
1803 ssize_t bytes;
1804 bytes = (ssize_t)sprintf(buf, "%zX\r\n", len);
@@ -1806,15 +1806,15 @@ ssize_t web_client_send_chunk_header(struct web_client *w, size_t len)
1806
1807 bytes = web_client_send_data(w,buf,strlen(buf),0);
1808 if(bytes > 0) {
1809 - debug(D_DEFLATE, "%llu: Sent chunk header %zd bytes.", w->id, bytes);
1809 + netdata_log_debug(D_DEFLATE, "%llu: Sent chunk header %zd bytes.", w->id, bytes);
1810 w->statistics.sent_bytes += bytes;
1811 }
1812
1813 else if(bytes == 0) {
1814 - debug(D_WEB_CLIENT, "%llu: Did not send chunk header to the client.", w->id);
1814 + netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send chunk header to the client.", w->id);
1815 }
1816 else {
1817 - debug(D_WEB_CLIENT, "%llu: Failed to send chunk header to client.", w->id);
1817 + netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send chunk header to client.", w->id);
1818 WEB_CLIENT_IS_DEAD(w);
1819 }
1820
@@ -1828,15 +1828,15 @@ ssize_t web_client_send_chunk_close(struct web_client *w)
1828 ssize_t bytes;
1829 bytes = web_client_send_data(w,"\r\n",2,0);
1830 if(bytes > 0) {
1831 - debug(D_DEFLATE, "%llu: Sent chunk suffix %zd bytes.", w->id, bytes);
1831 + netdata_log_debug(D_DEFLATE, "%llu: Sent chunk suffix %zd bytes.", w->id, bytes);
1832 w->statistics.sent_bytes += bytes;
1833 }
1834
1835 else if(bytes == 0) {
1836 - debug(D_WEB_CLIENT, "%llu: Did not send chunk suffix to the client.", w->id);
1836 + netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send chunk suffix to the client.", w->id);
1837 }
1838 else {
1839 - debug(D_WEB_CLIENT, "%llu: Failed to send chunk suffix to client.", w->id);
1839 + netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send chunk suffix to client.", w->id);
1840 WEB_CLIENT_IS_DEAD(w);
1841 }
1842
@@ -1850,15 +1850,15 @@ ssize_t web_client_send_chunk_finalize(struct web_client *w)
1850 ssize_t bytes;
1851 bytes = web_client_send_data(w,"\r\n0\r\n\r\n",7,0);
1852 if(bytes > 0) {
1853 - debug(D_DEFLATE, "%llu: Sent chunk suffix %zd bytes.", w->id, bytes);
1853 + netdata_log_debug(D_DEFLATE, "%llu: Sent chunk suffix %zd bytes.", w->id, bytes);
1854 w->statistics.sent_bytes += bytes;
1855 }
1856
1857 else if(bytes == 0) {
1858 - debug(D_WEB_CLIENT, "%llu: Did not send chunk finalize suffix to the client.", w->id);
1858 + netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send chunk finalize suffix to the client.", w->id);
1859 }
1860 else {
1861 - debug(D_WEB_CLIENT, "%llu: Failed to send chunk finalize suffix to client.", w->id);
1861 + netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send chunk finalize suffix to client.", w->id);
1862 WEB_CLIENT_IS_DEAD(w);
1863 }
1864
@@ -1872,13 +1872,13 @@ ssize_t web_client_send_deflate(struct web_client *w)
1872 // when using compression,
1873 // w->response.sent is the amount of bytes passed through compression
1874
1875 - debug(D_DEFLATE, "%llu: web_client_send_deflate(): w->response.data->len = %zu, w->response.sent = %zu, w->response.zhave = %zu, w->response.zsent = %zu, w->response.zstream.avail_in = %u, w->response.zstream.avail_out = %u, w->response.zstream.total_in = %lu, w->response.zstream.total_out = %lu.",
1875 + netdata_log_debug(D_DEFLATE, "%llu: web_client_send_deflate(): w->response.data->len = %zu, w->response.sent = %zu, w->response.zhave = %zu, w->response.zsent = %zu, w->response.zstream.avail_in = %u, w->response.zstream.avail_out = %u, w->response.zstream.total_in = %lu, w->response.zstream.total_out = %lu.",
1876 w->id, w->response.data->len, w->response.sent, w->response.zhave, w->response.zsent, w->response.zstream.avail_in, w->response.zstream.avail_out, w->response.zstream.total_in, w->response.zstream.total_out);
1877
1878 if(w->response.data->len - w->response.sent == 0 && w->response.zstream.avail_in == 0 && w->response.zhave == w->response.zsent && w->response.zstream.avail_out != 0) {
1879 // there is nothing to send
1880
1881 - debug(D_WEB_CLIENT, "%llu: Out of output data.", w->id);
1881 + netdata_log_debug(D_WEB_CLIENT, "%llu: Out of output data.", w->id);
1882
1883 // finalize the chunk
1884 if(w->response.sent != 0) {
@@ -1888,20 +1888,20 @@ ssize_t web_client_send_deflate(struct web_client *w)
1888
1889 if(w->mode == WEB_CLIENT_MODE_FILECOPY && web_client_has_wait_receive(w) && w->response.rlen && w->response.rlen > w->response.data->len) {
1890 // we have to wait, more data will come
1891 - debug(D_WEB_CLIENT, "%llu: Waiting for more data to become available.", w->id);
1891 + netdata_log_debug(D_WEB_CLIENT, "%llu: Waiting for more data to become available.", w->id);
1892 web_client_disable_wait_send(w);
1893 return t;
1894 }
1895
1896 if(unlikely(!web_client_has_keepalive(w))) {
1897 - debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
1897 + netdata_log_debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
1898 WEB_CLIENT_IS_DEAD(w);
1899 return t;
1900 }
1901
1902 // reset the client
1903 web_client_request_done(w);
1904 - debug(D_WEB_CLIENT, "%llu: Done sending all data on socket.", w->id);
1904 + netdata_log_debug(D_WEB_CLIENT, "%llu: Done sending all data on socket.", w->id);
1905 return t;
1906 }
1907
@@ -1914,7 +1914,7 @@ ssize_t web_client_send_deflate(struct web_client *w)
1914 if(t < 0) return t;
1915 }
1916
1917 - debug(D_DEFLATE, "%llu: Compressing %zu new bytes starting from %zu (and %u left behind).", w->id, (w->response.data->len - w->response.sent), w->response.sent, w->response.zstream.avail_in);
1917 + netdata_log_debug(D_DEFLATE, "%llu: Compressing %zu new bytes starting from %zu (and %u left behind).", w->id, (w->response.data->len - w->response.sent), w->response.sent, w->response.zstream.avail_in);
1918
1919 // give the compressor all the data not passed through the compressor yet
1920 if(w->response.data->len > w->response.sent) {
@@ -1931,10 +1931,10 @@ ssize_t web_client_send_deflate(struct web_client *w)
1931 if((w->mode == WEB_CLIENT_MODE_GET || w->mode == WEB_CLIENT_MODE_POST)
1932 || (w->mode == WEB_CLIENT_MODE_FILECOPY && !web_client_has_wait_receive(w) && w->response.data->len == w->response.rlen)) {
1933 flush = Z_FINISH;
1934 - debug(D_DEFLATE, "%llu: Requesting Z_FINISH, if possible.", w->id);
1934 + netdata_log_debug(D_DEFLATE, "%llu: Requesting Z_FINISH, if possible.", w->id);
1935 }
1936 else {
1937 - debug(D_DEFLATE, "%llu: Requesting Z_SYNC_FLUSH.", w->id);
1937 + netdata_log_debug(D_DEFLATE, "%llu: Requesting Z_SYNC_FLUSH.", w->id);
1938 }
1939
1940 // compress
@@ -1950,30 +1950,30 @@ ssize_t web_client_send_deflate(struct web_client *w)
1950 // keep track of the bytes passed through the compressor
1951 w->response.sent = w->response.data->len;
1952
1953 - debug(D_DEFLATE, "%llu: Compression produced %zu bytes.", w->id, w->response.zhave);
1953 + netdata_log_debug(D_DEFLATE, "%llu: Compression produced %zu bytes.", w->id, w->response.zhave);
1954
1955 // open a new chunk
1956 ssize_t t2 = web_client_send_chunk_header(w, w->response.zhave);
1957 if(t2 < 0) return t2;
1958 t += t2;
1959 }
1960 -
1961 - debug(D_WEB_CLIENT, "%llu: Sending %zu bytes of data (+%zd of chunk header).", w->id, w->response.zhave - w->response.zsent, t);
1960 +
1961 + netdata_log_debug(D_WEB_CLIENT, "%llu: Sending %zu bytes of data (+%zd of chunk header).", w->id, w->response.zhave - w->response.zsent, t);
1962
1963 len = web_client_send_data(w,&w->response.zbuffer[w->response.zsent], (size_t) (w->response.zhave - w->response.zsent), MSG_DONTWAIT);
1964 if(len > 0) {
1965 w->statistics.sent_bytes += len;
1966 w->response.zsent += len;
1967 len += t;
1968 - debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, len);
1968 + netdata_log_debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, len);
1969 }
1970 else if(len == 0) {
1971 - debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client (zhave = %zu, zsent = %zu, need to send = %zu).",
1971 + netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client (zhave = %zu, zsent = %zu, need to send = %zu).",
1972 w->id, w->response.zhave, w->response.zsent, w->response.zhave - w->response.zsent);
1973
1974 }
1975 else {
1976 - debug(D_WEB_CLIENT, "%llu: Failed to send data to client.", w->id);
1976 + netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send data to client.", w->id);
1977 WEB_CLIENT_IS_DEAD(w);
1978 }
1979
@@ -1988,7 +1988,7 @@ ssize_t web_client_send(struct web_client *w) {
1988 if(unlikely(w->response.data->len - w->response.sent == 0)) {
1989 // there is nothing to send
1990
1991 - debug(D_WEB_CLIENT, "%llu: Out of output data.", w->id);
1991 + netdata_log_debug(D_WEB_CLIENT, "%llu: Out of output data.", w->id);
1992
1993 // there can be two cases for this
1994 // A. we have done everything
@@ -1996,19 +1996,19 @@ ssize_t web_client_send(struct web_client *w) {
1996
1997 if(w->mode == WEB_CLIENT_MODE_FILECOPY && web_client_has_wait_receive(w) && w->response.rlen && w->response.rlen > w->response.data->len) {
1998 // we have to wait, more data will come
1999 - debug(D_WEB_CLIENT, "%llu: Waiting for more data to become available.", w->id);
1999 + netdata_log_debug(D_WEB_CLIENT, "%llu: Waiting for more data to become available.", w->id);
2000 web_client_disable_wait_send(w);
2001 return 0;
2002 }
2003
2004 if(unlikely(!web_client_has_keepalive(w))) {
2005 - debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
2005 + netdata_log_debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
2006 WEB_CLIENT_IS_DEAD(w);
2007 return 0;
2008 }
2009
2010 web_client_request_done(w);
2011 - debug(D_WEB_CLIENT, "%llu: Done sending all data on socket. Waiting for next request on the same socket.", w->id);
2011 + netdata_log_debug(D_WEB_CLIENT, "%llu: Done sending all data on socket. Waiting for next request on the same socket.", w->id);
2012 return 0;
2013 }
2014
@@ -2016,13 +2016,13 @@ ssize_t web_client_send(struct web_client *w) {
2016 if(likely(bytes > 0)) {
2017 w->statistics.sent_bytes += bytes;
2018 w->response.sent += bytes;
2019 - debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, bytes);
2019 + netdata_log_debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, bytes);
2020 }
2021 else if(likely(bytes == 0)) {
2022 - debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client.", w->id);
2022 + netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client.", w->id);
2023 }
2024 else {
2025 - debug(D_WEB_CLIENT, "%llu: Failed to send data to client.", w->id);
2025 + netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send data to client.", w->id);
2026 WEB_CLIENT_IS_DEAD(w);
2027 }
2028
@@ -2046,8 +2046,8 @@ ssize_t web_client_read_file(struct web_client *w)
2046 w->response.data->len += bytes;
2047 w->response.data->buffer[w->response.data->len] = '\0';
2048
2049 - debug(D_WEB_CLIENT, "%llu: Read %zd bytes.", w->id, bytes);
2050 - debug(D_WEB_DATA, "%llu: Read data: '%s'.", w->id, &w->response.data->buffer[old]);
2049 + netdata_log_debug(D_WEB_CLIENT, "%llu: Read %zd bytes.", w->id, bytes);
2050 + netdata_log_debug(D_WEB_DATA, "%llu: Read data: '%s'.", w->id, &w->response.data->buffer[old]);
2051
2052 web_client_enable_wait_send(w);
2053
@@ -2055,7 +2055,7 @@ ssize_t web_client_read_file(struct web_client *w)
2055 web_client_disable_wait_receive(w);
2056 }
2057 else if(likely(bytes == 0)) {
2058 - debug(D_WEB_CLIENT, "%llu: Out of input file data.", w->id);
2058 + netdata_log_debug(D_WEB_CLIENT, "%llu: Out of input file data.", w->id);
2059
2060 // if we cannot read, it means we have an error on input.
2061 // if however, we are copying a file from ifd to ofd, we should not return an error.
@@ -2065,7 +2065,7 @@ ssize_t web_client_read_file(struct web_client *w)
2065 // let it finish copying...
2066 web_client_disable_wait_receive(w);
2067
2068 - debug(D_WEB_CLIENT, "%llu: Read the whole file.", w->id);
2068 + netdata_log_debug(D_WEB_CLIENT, "%llu: Read the whole file.", w->id);
2069
2070 if(web_server_mode != WEB_SERVER_MODE_STATIC_THREADED) {
2071 if (w->ifd != w->ofd) close(w->ifd);
@@ -2074,7 +2074,7 @@ ssize_t web_client_read_file(struct web_client *w)
2074 w->ifd = w->ofd;
2075 }
2076 else {
2077 - debug(D_WEB_CLIENT, "%llu: read data failed.", w->id);
2077 + netdata_log_debug(D_WEB_CLIENT, "%llu: read data failed.", w->id);
2078 WEB_CLIENT_IS_DEAD(w);
2079 }
2080
@@ -2120,18 +2120,18 @@ ssize_t web_client_receive(struct web_client *w)
2120 w->response.data->len += bytes;
2121 w->response.data->buffer[w->response.data->len] = '\0';
2122
2123 - debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
2124 - debug(D_WEB_DATA, "%llu: Received data: '%s'.", w->id, &w->response.data->buffer[old]);
2123 + netdata_log_debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
2124 + netdata_log_debug(D_WEB_DATA, "%llu: Received data: '%s'.", w->id, &w->response.data->buffer[old]);
2125 }
2126 else if(unlikely(bytes < 0 && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR))) {
2127 web_client_enable_wait_receive(w);
2128 return 0;
2129 }
2130 else if (bytes < 0) {
2131 - debug(D_WEB_CLIENT, "%llu: receive data failed.", w->id);
2131 + netdata_log_debug(D_WEB_CLIENT, "%llu: receive data failed.", w->id);
2132 WEB_CLIENT_IS_DEAD(w);
2133 } else
2134 - debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
2134 + netdata_log_debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
2135
2136 return(bytes);
2137 }
web/server/web_server.c
+1 -1
@@ -48,7 +48,7 @@ void debug_sockets() {
48 buffer_strcat(wb, (api_sockets.fds_acl_flags[i] & WEB_CLIENT_ACL_MGMT)?"management ":"");
49 buffer_strcat(wb, (api_sockets.fds_acl_flags[i] & WEB_CLIENT_ACL_STREAMING)?"streaming ":"");
50 buffer_strcat(wb, (api_sockets.fds_acl_flags[i] & WEB_CLIENT_ACL_NETDATACONF)?"netdata.conf ":"");
51 - debug(D_WEB_CLIENT, "Socket fd %d name '%s' acl_flags: %s",
51 + netdata_log_debug(D_WEB_CLIENT, "Socket fd %d name '%s' acl_flags: %s",
52 i,
53 api_sockets.fds_names[i],
54 buffer_tostring(wb));