Rename log_access and log_health (#15368)
Emmanuel Vasilakis committed
Jul 13, 2023 at 11:18 UTC
3b76a3a3d948d4db89b686af0b139d61ad63e07a
21 files changed
+75
-74
aclk/aclk.c
+3
-3
@@ -408,7 +408,7 @@ void aclk_graceful_disconnect(mqtt_wss_client client)
408
}
409
}
410
netdata_log_info("ACLK link is down");
411
- log_access("ACLK DISCONNECTED");
411
+ netdata_log_access("ACLK DISCONNECTED");
412
aclk_stats_upd_online(0);
413
last_disconnect_time = now_realtime_sec();
414
aclk_connected = 0;
@@ -752,7 +752,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client)
752
last_conn_time_mqtt = now_realtime_sec();
753
netdata_log_info("ACLK connection successfully established");
754
aclk_status = ACLK_STATUS_CONNECTED;
755
- log_access("ACLK CONNECTED");
755
+ netdata_log_access("ACLK CONNECTED");
756
mqtt_connected_actions(client);
757
return 0;
758
}
@@ -857,7 +857,7 @@ void *aclk_main(void *ptr)
857
aclk_stats_upd_online(0);
858
last_disconnect_time = now_realtime_sec();
859
aclk_connected = 0;
860
- log_access("ACLK DISCONNECTED");
860
+ netdata_log_access("ACLK DISCONNECTED");
861
}
862
} while (service_running(SERVICE_ACLK));
863
aclk/aclk_query.c
+2
-2
@@ -110,7 +110,7 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
110
usec_t t;
111
web_client_timeout_checkpoint_set(w, query->timeout);
112
if(web_client_timeout_checkpoint_and_check(w, &t)) {
113
- log_access("QUERY CANCELED: QUEUE TIME EXCEEDED %llu ms (LIMIT %d ms)", t / USEC_PER_MS, query->timeout);
113
+ netdata_log_access("QUERY CANCELED: QUEUE TIME EXCEEDED %llu ms (LIMIT %d ms)", t / USEC_PER_MS, query->timeout);
114
retval = 1;
115
w->response.code = HTTP_RESP_BACKEND_FETCH_FAILED;
116
aclk_http_msg_v2_err(query_thr->client, query->callback_topic, query->msg_id, w->response.code, CLOUD_EC_SND_TIMEOUT, CLOUD_EMSG_SND_TIMEOUT, NULL, 0);
@@ -222,7 +222,7 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
222
223
cleanup:
224
now_monotonic_high_precision_timeval(&tv);
225
- log_access("%llu: %d '[ACLK]:%d' '%s' (sent/all = %zu/%zu bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %d '%s'",
225
+ netdata_log_access("%llu: %d '[ACLK]:%d' '%s' (sent/all = %zu/%zu bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %d '%s'",
226
w->id
227
, gettid()
228
, query_thr->idx
aclk/aclk_rx_msgs.c
+1
-1
@@ -455,7 +455,7 @@ int cancel_pending_req(const char *msg, size_t msg_len)
455
return 1;
456
}
457
458
- log_access("ACLK CancelPendingRequest REQ: %s, cloud trace-id: %s", cmd.request_id, cmd.trace_id);
458
+ netdata_log_access("ACLK CancelPendingRequest REQ: %s, cloud trace-id: %s", cmd.request_id, cmd.trace_id);
459
460
if (mark_pending_req_cancelled(cmd.request_id))
461
error_report("CancelPending Request for %s failed. No such pending request.", cmd.request_id);
collectors/statsd.plugin/statsd.c
+1
-1
@@ -2283,7 +2283,7 @@ static inline void statsd_flush_index_metrics(STATSD_INDEX *index, void (*flush_
2283
if(unlikely(is_metric_checked(m))) break;
2284
2285
if(unlikely(!(m->options & STATSD_METRIC_OPTION_CHECKED_IN_APPS))) {
2286
- log_access("NEW STATSD METRIC '%s': '%s'", statsd_metric_type_string(m->type), m->name);
2286
+ netdata_log_access("NEW STATSD METRIC '%s': '%s'", statsd_metric_type_string(m->type), m->name);
2287
check_if_metric_is_for_app(index, m);
2288
m->options |= STATSD_METRIC_OPTION_CHECKED_IN_APPS;
2289
}
database/contexts/rrdcontext.c
+2
-2
@@ -279,7 +279,7 @@ void rrdcontext_hub_checkpoint_command(void *ptr) {
279
rrdhost_flag_set(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS);
280
char node_str[UUID_STR_LEN];
281
uuid_unparse_lower(*host->node_id, node_str);
282
- log_access("ACLK REQ [%s (%s)]: STREAM CONTEXTS ENABLED", node_str, rrdhost_hostname(host));
282
+ netdata_log_access("ACLK REQ [%s (%s)]: STREAM CONTEXTS ENABLED", node_str, rrdhost_hostname(host));
283
}
284
285
void rrdcontext_hub_stop_streaming_command(void *ptr) {
@@ -322,4 +322,4 @@ bool rrdcontext_retention_match(RRDCONTEXT_ACQUIRED *rca, time_t after, time_t b
322
return query_matches_retention(after, before, rc->first_time_s, before > rc->last_time_s ? before : rc->last_time_s, 1);
323
else
324
return query_matches_retention(after, before, rc->first_time_s, rc->last_time_s, 1);
325
-}
\ No newline at end of file
325
+}
database/rrdcalc.c
+1
-1
@@ -783,7 +783,7 @@ void rrdcalc_delete_alerts_not_matching_host_labels_from_this_host(RRDHOST *host
783
continue;
784
785
if(!rrdlabels_match_simple_pattern_parsed(host->rrdlabels, rc->host_labels_pattern, '=', NULL)) {
786
- log_health("Health configuration for alarm '%s' cannot be applied, because the host %s does not have the label(s) '%s'",
786
+ netdata_log_health("Health configuration for alarm '%s' cannot be applied, because the host %s does not have the label(s) '%s'",
787
rrdcalc_name(rc),
788
rrdhost_hostname(host),
789
rrdcalc_host_labels(rc));
database/sqlite/sqlite_aclk_alert.c
+21
-21
@@ -246,7 +246,7 @@ void aclk_push_alert_event(struct aclk_sync_host_config *wc)
246
int rc;
247
248
if (unlikely(!wc->alert_updates)) {
249
- log_access("ACLK STA [%s (%s)]: Ignoring alert push event, updates have been turned off for this node.", wc->node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A");
249
+ netdata_log_access("ACLK STA [%s (%s)]: Ignoring alert push event, updates have been turned off for this node.", wc->node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A");
250
return;
251
}
252
@@ -409,7 +409,7 @@ void aclk_push_alert_event(struct aclk_sync_host_config *wc)
409
410
} else {
411
if (wc->alerts_log_first_sequence_id)
412
- log_access(
412
+ netdata_log_access(
413
"ACLK RES [%s (%s)]: ALERTS SENT from %" PRIu64 " to %" PRIu64 "",
414
wc->node_id,
415
wc->host ? rrdhost_hostname(wc->host) : "N/A",
@@ -511,7 +511,7 @@ void aclk_send_alarm_configuration(char *config_hash)
511
if (unlikely(!wc))
512
return;
513
514
- log_access("ACLK REQ [%s (%s)]: Request to send alert config %s.", wc->node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A", config_hash);
514
+ netdata_log_access("ACLK REQ [%s (%s)]: Request to send alert config %s.", wc->node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A", config_hash);
515
516
aclk_push_alert_config(wc->node_id, config_hash);
517
}
@@ -627,13 +627,13 @@ int aclk_push_alert_config_event(char *node_id __maybe_unused, char *config_hash
627
}
628
629
if (likely(p_alarm_config.cfg_hash)) {
630
- log_access("ACLK RES [%s (%s)]: Sent alert config %s.", wc->node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A", config_hash);
630
+ netdata_log_access("ACLK RES [%s (%s)]: Sent alert config %s.", wc->node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A", config_hash);
631
aclk_send_provide_alarm_cfg(&p_alarm_config);
632
freez(p_alarm_config.cfg_hash);
633
destroy_aclk_alarm_configuration(&alarm_config);
634
}
635
else
636
- log_access("ACLK STA [%s (%s)]: Alert config for %s not found.", wc->node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A", config_hash);
636
+ netdata_log_access("ACLK STA [%s (%s)]: Alert config for %s not found.", wc->node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A", config_hash);
637
638
bind_fail:
639
rc = sqlite3_finalize(res);
@@ -668,15 +668,15 @@ void aclk_start_alert_streaming(char *node_id, bool resets)
668
return;
669
670
if (unlikely(!host->health.health_enabled)) {
671
- log_access("ACLK STA [%s (N/A)]: Ignoring request to stream alert state changes, health is disabled.", node_id);
671
+ netdata_log_access("ACLK STA [%s (N/A)]: Ignoring request to stream alert state changes, health is disabled.", node_id);
672
return;
673
}
674
675
if (resets) {
676
- log_access("ACLK REQ [%s (%s)]: STREAM ALERTS ENABLED (RESET REQUESTED)", node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A");
676
+ netdata_log_access("ACLK REQ [%s (%s)]: STREAM ALERTS ENABLED (RESET REQUESTED)", node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A");
677
sql_queue_existing_alerts_to_aclk(host);
678
} else
679
- log_access("ACLK REQ [%s (%s)]: STREAM ALERTS ENABLED", node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A");
679
+ netdata_log_access("ACLK REQ [%s (%s)]: STREAM ALERTS ENABLED", node_id, wc->host ? rrdhost_hostname(wc->host) : "N/A");
680
681
wc->alert_updates = 1;
682
wc->alert_queue_removed = SEND_REMOVED_AFTER_HEALTH_LOOPS;
@@ -726,7 +726,7 @@ void sql_process_queue_removed_alerts_to_aclk(char *node_id)
726
if (unlikely(rc != SQLITE_OK))
727
error_report("Failed to finalize statement to queue removed alerts, rc = %d", rc);
728
729
- log_access("ACLK STA [%s (%s)]: QUEUED REMOVED ALERTS", wc->node_id, rrdhost_hostname(wc->host));
729
+ netdata_log_access("ACLK STA [%s (%s)]: QUEUED REMOVED ALERTS", wc->node_id, rrdhost_hostname(wc->host));
730
731
rrdhost_flag_set(wc->host, RRDHOST_FLAG_ACLK_STREAM_ALERTS);
732
wc->alert_queue_removed = 0;
@@ -754,18 +754,18 @@ void aclk_process_send_alarm_snapshot(char *node_id, char *claim_id __maybe_unus
754
755
RRDHOST *host = find_host_by_node_id(node_id);
756
if (unlikely(!host)) {
757
- log_access("ACLK STA [%s (N/A)]: ACLK node id does not exist", node_id);
757
+ netdata_log_access("ACLK STA [%s (N/A)]: ACLK node id does not exist", node_id);
758
return;
759
}
760
761
struct aclk_sync_host_config *wc = (struct aclk_sync_host_config *)host->aclk_sync_host_config;
762
763
if (unlikely(!wc)) {
764
- log_access("ACLK STA [%s (N/A)]: ACLK node id does not exist", node_id);
764
+ netdata_log_access("ACLK STA [%s (N/A)]: ACLK node id does not exist", node_id);
765
return;
766
}
767
768
- log_access(
768
+ netdata_log_access(
769
"IN [%s (%s)]: Request to send alerts snapshot, snapshot_uuid %s",
770
node_id,
771
wc->host ? rrdhost_hostname(wc->host) : "N/A",
@@ -858,7 +858,7 @@ void aclk_push_alert_snapshot_event(char *node_id __maybe_unused)
858
RRDHOST *host = find_host_by_node_id(node_id);
859
860
if (unlikely(!host)) {
861
- log_access("AC [%s (N/A)]: Node id not found", node_id);
861
+ netdata_log_access("AC [%s (N/A)]: Node id not found", node_id);
862
freez(node_id);
863
return;
864
}
@@ -868,7 +868,7 @@ void aclk_push_alert_snapshot_event(char *node_id __maybe_unused)
868
869
// we perhaps we don't need this for snapshots
870
if (unlikely(!wc->alert_updates)) {
871
- log_access(
871
+ netdata_log_access(
872
"ACLK STA [%s (%s)]: Ignoring alert snapshot event, updates have been turned off for this node.",
873
wc->node_id,
874
wc->host ? rrdhost_hostname(wc->host) : "N/A");
@@ -882,7 +882,7 @@ void aclk_push_alert_snapshot_event(char *node_id __maybe_unused)
882
if (unlikely(!claim_id))
883
return;
884
885
- log_access("ACLK REQ [%s (%s)]: Sending alerts snapshot, snapshot_uuid %s", wc->node_id, rrdhost_hostname(wc->host), wc->alerts_snapshot_uuid);
885
+ netdata_log_access("ACLK REQ [%s (%s)]: Sending alerts snapshot, snapshot_uuid %s", wc->node_id, rrdhost_hostname(wc->host), wc->alerts_snapshot_uuid);
886
887
uint32_t cnt = 0;
888
char uuid_str[UUID_STR_LEN];
@@ -1047,11 +1047,11 @@ void aclk_send_alarm_checkpoint(char *node_id, char *claim_id __maybe_unused)
1047
1048
wc = (struct aclk_sync_host_config *)host->aclk_sync_host_config;
1049
if (unlikely(!wc)) {
1050
- log_access("ACLK REQ [%s (N/A)]: ALERTS CHECKPOINT REQUEST RECEIVED FOR INVALID NODE", node_id);
1050
+ netdata_log_access("ACLK REQ [%s (N/A)]: ALERTS CHECKPOINT REQUEST RECEIVED FOR INVALID NODE", node_id);
1051
return;
1052
}
1053
1054
- log_access("ACLK REQ [%s (%s)]: ALERTS CHECKPOINT REQUEST RECEIVED", node_id, rrdhost_hostname(host));
1054
+ netdata_log_access("ACLK REQ [%s (%s)]: ALERTS CHECKPOINT REQUEST RECEIVED", node_id, rrdhost_hostname(host));
1055
1056
wc->alert_checkpoint_req = SEND_CHECKPOINT_AFTER_HEALTH_LOOPS;
1057
}
@@ -1080,14 +1080,14 @@ void aclk_push_alarm_checkpoint(RRDHOST *host __maybe_unused)
1080
#ifdef ENABLE_ACLK
1081
struct aclk_sync_host_config *wc = host->aclk_sync_host_config;
1082
if (unlikely(!wc)) {
1083
- log_access("ACLK REQ [%s (N/A)]: ALERTS CHECKPOINT REQUEST RECEIVED FOR INVALID NODE", rrdhost_hostname(host));
1083
+ netdata_log_access("ACLK REQ [%s (N/A)]: ALERTS CHECKPOINT REQUEST RECEIVED FOR INVALID NODE", rrdhost_hostname(host));
1084
return;
1085
}
1086
1087
if (rrdhost_flag_check(host, RRDHOST_FLAG_ACLK_STREAM_ALERTS)) {
1088
//postpone checkpoint send
1089
wc->alert_checkpoint_req+=3;
1090
- log_access("ACLK REQ [%s (N/A)]: ALERTS CHECKPOINT POSTPONED", rrdhost_hostname(host));
1090
+ netdata_log_access("ACLK REQ [%s (N/A)]: ALERTS CHECKPOINT POSTPONED", rrdhost_hostname(host));
1091
return;
1092
}
1093
@@ -1150,9 +1150,9 @@ void aclk_push_alarm_checkpoint(RRDHOST *host __maybe_unused)
1150
1151
aclk_send_provide_alarm_checkpoint(&alarm_checkpoint);
1152
freez(claim_id);
1153
- log_access("ACLK RES [%s (%s)]: ALERTS CHECKPOINT SENT", wc->node_id, rrdhost_hostname(host));
1153
+ netdata_log_access("ACLK RES [%s (%s)]: ALERTS CHECKPOINT SENT", wc->node_id, rrdhost_hostname(host));
1154
} else {
1155
- log_access("ACLK RES [%s (%s)]: FAILED TO CREATE ALERTS CHECKPOINT HASH", wc->node_id, rrdhost_hostname(host));
1155
+ netdata_log_access("ACLK RES [%s (%s)]: FAILED TO CREATE ALERTS CHECKPOINT HASH", wc->node_id, rrdhost_hostname(host));
1156
}
1157
wc->alert_checkpoint_req = 0;
1158
buffer_free(alarms_to_hash);
database/sqlite/sqlite_aclk_node.c
+2
-2
@@ -50,7 +50,7 @@ static void build_node_collectors(char *node_id __maybe_unused)
50
dictionary_destroy(dict);
51
freez(upd_node_collectors.claim_id);
52
53
- log_access("ACLK RES [%s (%s)]: NODE COLLECTORS SENT", node_id, rrdhost_hostname(host));
53
+ netdata_log_access("ACLK RES [%s (%s)]: NODE COLLECTORS SENT", node_id, rrdhost_hostname(host));
54
55
freez(node_id);
56
}
@@ -124,7 +124,7 @@ static void build_node_info(char *node_id __maybe_unused)
124
node_info.data.host_labels_ptr = host->rrdlabels;
125
126
aclk_update_node_info(&node_info);
127
- log_access("ACLK RES [%s (%s)]: NODE INFO SENT for guid [%s] (%s)", wc->node_id, rrdhost_hostname(wc->host), host->machine_guid, wc->host == localhost ? "parent" : "child");
127
+ netdata_log_access("ACLK RES [%s (%s)]: NODE INFO SENT for guid [%s] (%s)", wc->node_id, rrdhost_hostname(wc->host), host->machine_guid, wc->host == localhost ? "parent" : "child");
128
129
rrd_unlock();
130
freez(node_info.claim_id);
database/sqlite/sqlite_health.c
+1
-1
@@ -975,7 +975,7 @@ void sql_health_alarm_log_load(RRDHOST *host) {
975
if (unlikely(!host->health_log.next_alarm_id || host->health_log.next_alarm_id <= host->health_max_alarm_id))
976
host->health_log.next_alarm_id = host->health_max_alarm_id + 1;
977
978
- log_health("[%s]: Table health_log, loaded %zd alarm entries, errors in %zd entries.", rrdhost_hostname(host), loaded, errored);
978
+ netdata_log_health("[%s]: Table health_log, loaded %zd alarm entries, errors in %zd entries.", rrdhost_hostname(host), loaded, errored);
979
980
ret = sqlite3_finalize(res);
981
if (unlikely(ret != SQLITE_OK))
health/health.c
+18
-17
@@ -342,7 +342,7 @@ static void health_reload_host(RRDHOST *host) {
342
if(unlikely(!host->health.health_enabled) && !rrdhost_flag_check(host, RRDHOST_FLAG_INITIALIZED_HEALTH))
343
return;
344
345
- log_health("[%s]: Reloading health.", rrdhost_hostname(host));
345
+ netdata_log_health("[%s]: Reloading health.", rrdhost_hostname(host));
346
347
char *user_path = health_user_config_dir();
348
char *stock_path = health_stock_config_dir();
@@ -440,7 +440,8 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
440
if(unlikely(ae->new_status <= RRDCALC_STATUS_CLEAR && (ae->flags & HEALTH_ENTRY_FLAG_NO_CLEAR_NOTIFICATION))) {
441
// do not send notifications for disabled statuses
442
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));
443
- 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));
443
+ netdata_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));
444
+
445
// mark it as run, so that we will send the same alarm if it happens again
446
goto done;
447
}
@@ -458,7 +459,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
459
// don't send the notification for the same status again
460
netdata_log_debug(D_HEALTH, "Health not sending again notification for alarm '%s.%s' status %s", ae_chart_name(ae), ae_name(ae)
461
, rrdcalc_status2string(ae->new_status));
461
- log_health("[%s]: Health not sending again notification for alarm '%s.%s' status %s", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae)
462
+ netdata_log_health("[%s]: Health not sending again notification for alarm '%s.%s' status %s", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae)
463
, rrdcalc_status2string(ae->new_status));
464
goto done;
465
}
@@ -478,11 +479,11 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
479
480
// Check if alarm notifications are silenced
481
if (ae->flags & HEALTH_ENTRY_FLAG_SILENCED) {
481
- log_health("[%s]: Health not sending notification for alarm '%s.%s' status %s (command API has disabled notifications)", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
482
+ netdata_log_health("[%s]: Health not sending notification for alarm '%s.%s' status %s (command API has disabled notifications)", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
483
goto done;
484
}
485
485
- log_health("[%s]: Sending notification for alarm '%s.%s' status %s.", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
486
+ netdata_log_health("[%s]: Sending notification for alarm '%s.%s' status %s.", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
487
488
const char *exec = (ae->exec) ? ae_exec(ae) : string2str(host->health.health_default_exec);
489
const char *recipient = (ae->recipient) ? ae_recipient(ae) : string2str(host->health.health_default_recipient);
@@ -785,7 +786,7 @@ static void health_main_cleanup(void *ptr) {
786
netdata_log_info("cleaning up...");
787
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
788
788
- log_health("Health thread ended.");
789
+ netdata_log_health("Health thread ended.");
790
}
791
792
static void initialize_health(RRDHOST *host)
@@ -797,7 +798,7 @@ static void initialize_health(RRDHOST *host)
798
799
rrdhost_flag_set(host, RRDHOST_FLAG_INITIALIZED_HEALTH);
800
800
- log_health("[%s]: Initializing health.", rrdhost_hostname(host));
801
+ netdata_log_health("[%s]: Initializing health.", rrdhost_hostname(host));
802
803
host->health.health_default_warn_repeat_every = config_get_duration(CONFIG_SECTION_HEALTH, "default repeat warning", "never");
804
host->health.health_default_crit_repeat_every = config_get_duration(CONFIG_SECTION_HEALTH, "default repeat critical", "never");
@@ -810,7 +811,7 @@ static void initialize_health(RRDHOST *host)
811
812
long n = config_get_number(CONFIG_SECTION_HEALTH, "in memory max health log entries", host->health_log.max);
813
if(n < 10) {
813
- log_health("Host '%s': health configuration has invalid max log entries %ld. Using default %u", rrdhost_hostname(host), n, host->health_log.max);
814
+ netdata_log_health("Host '%s': health configuration has invalid max log entries %ld. Using default %u", rrdhost_hostname(host), n, host->health_log.max);
815
config_set_number(CONFIG_SECTION_HEALTH, "in memory max health log entries", (long)host->health_log.max);
816
}
817
else
@@ -818,7 +819,7 @@ static void initialize_health(RRDHOST *host)
819
820
uint32_t m = config_get_number(CONFIG_SECTION_HEALTH, "health log history", HEALTH_LOG_DEFAULT_HISTORY);
821
if (m < HEALTH_LOG_MINIMUM_HISTORY) {
821
- log_health("Host '%s': health configuration has invalid health log history %u. Using minimum %d", rrdhost_hostname(host), m, HEALTH_LOG_MINIMUM_HISTORY);
822
+ netdata_log_health("Host '%s': health configuration has invalid health log history %u. Using minimum %d", rrdhost_hostname(host), m, HEALTH_LOG_MINIMUM_HISTORY);
823
config_set_number(CONFIG_SECTION_HEALTH, "health log history", HEALTH_LOG_MINIMUM_HISTORY);
824
m = HEALTH_LOG_MINIMUM_HISTORY;
825
}
@@ -830,7 +831,7 @@ static void initialize_health(RRDHOST *host)
831
} else
832
host->health_log.health_log_history = m;
833
833
- log_health("[%s]: Health log history is set to %u seconds (%u days)", rrdhost_hostname(host), host->health_log.health_log_history, host->health_log.health_log_history / 86400);
834
+ netdata_log_health("[%s]: Health log history is set to %u seconds (%u days)", rrdhost_hostname(host), host->health_log.health_log_history, host->health_log.health_log_history / 86400);
835
836
conf_enabled_alarms = simple_pattern_create(config_get(CONFIG_SECTION_HEALTH, "enabled alarms", "*"), NULL,
837
SIMPLE_PATTERN_EXACT, true);
@@ -1062,7 +1063,7 @@ void *health_main(void *ptr) {
1063
if (unlikely(check_if_resumed_from_suspension())) {
1064
apply_hibernation_delay = 1;
1065
1065
- log_health(
1066
+ netdata_log_health(
1067
"Postponing alarm checks for %"PRId64" seconds, "
1068
"because it seems that the system was just resumed from suspension.",
1069
(int64_t)hibernation_delay);
@@ -1071,7 +1072,7 @@ void *health_main(void *ptr) {
1072
if (unlikely(silencers->all_alarms && silencers->stype == STYPE_DISABLE_ALARMS)) {
1073
static int logged=0;
1074
if (!logged) {
1074
- log_health("Skipping health checks, because all alarms are disabled via a %s command.",
1075
+ netdata_log_health("Skipping health checks, because all alarms are disabled via a %s command.",
1076
HEALTH_CMDAPI_CMD_DISABLEALL);
1077
logged = 1;
1078
}
@@ -1094,7 +1095,7 @@ void *health_main(void *ptr) {
1095
rrdcalc_delete_alerts_not_matching_host_labels_from_this_host(host);
1096
1097
if (unlikely(apply_hibernation_delay)) {
1097
- log_health(
1098
+ netdata_log_health(
1099
"[%s]: Postponing health checks for %"PRId64" seconds.",
1100
rrdhost_hostname(host),
1101
(int64_t)hibernation_delay);
@@ -1107,20 +1108,20 @@ void *health_main(void *ptr) {
1108
continue;
1109
}
1110
1110
- log_health("[%s]: Resuming health checks after delay.", rrdhost_hostname(host));
1111
+ netdata_log_health("[%s]: Resuming health checks after delay.", rrdhost_hostname(host));
1112
host->health.health_delay_up_to = 0;
1113
}
1114
1115
// wait until cleanup of obsolete charts on children is complete
1116
if (host != localhost) {
1117
if (unlikely(host->trigger_chart_obsoletion_check == 1)) {
1117
- log_health("[%s]: Waiting for chart obsoletion check.", rrdhost_hostname(host));
1118
+ netdata_log_health("[%s]: Waiting for chart obsoletion check.", rrdhost_hostname(host));
1119
continue;
1120
}
1121
}
1122
1123
if (!health_running_logged) {
1123
- log_health("[%s]: Health is running.", rrdhost_hostname(host));
1124
+ netdata_log_health("[%s]: Health is running.", rrdhost_hostname(host));
1125
health_running_logged = true;
1126
}
1127
@@ -1445,7 +1446,7 @@ void *health_main(void *ptr) {
1446
1447
health_alarm_log_add_entry(host, ae);
1448
1448
- log_health("[%s]: Alert event for [%s.%s], value [%s], status [%s].", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae), ae_new_value_string(ae), rrdcalc_status2string(ae->new_status));
1449
+ netdata_log_health("[%s]: Alert event for [%s.%s], value [%s], status [%s].", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae), ae_new_value_string(ae), rrdcalc_status2string(ae->new_status));
1450
1451
rc->last_status_change_value = rc->value;
1452
rc->last_status_change = now;
health/health_config.c
+2
-2
@@ -1336,7 +1336,7 @@ void health_readdir(RRDHOST *host, const char *user_path, const char *stock_path
1336
CONFIG_BOOLEAN_YES);
1337
1338
if (!stock_enabled) {
1339
- log_health("[%s]: Netdata will not load stock alarms.", rrdhost_hostname(host));
1339
+ netdata_log_health("[%s]: Netdata will not load stock alarms.", rrdhost_hostname(host));
1340
stock_path = user_path;
1341
}
1342
@@ -1344,6 +1344,6 @@ void health_readdir(RRDHOST *host, const char *user_path, const char *stock_path
1344
health_rrdvars = health_rrdvariables_create();
1345
1346
recursive_config_double_dir_load(user_path, stock_path, subpath, health_readfile, (void *) host, 0);
1347
- log_health("[%s]: Read health configuration.", rrdhost_hostname(host));
1347
+ netdata_log_health("[%s]: Read health configuration.", rrdhost_hostname(host));
1348
sql_store_hashes = 0;
1349
}
libnetdata/log/log.c
+2
-2
@@ -1046,7 +1046,7 @@ void fatal_int( const char *file, const char *function, const unsigned long line
1046
// ----------------------------------------------------------------------------
1047
// access log
1048
1049
-void log_access( const char *fmt, ... ) {
1049
+void netdata_log_access( const char *fmt, ... ) {
1050
va_list args;
1051
1052
if(access_log_syslog) {
@@ -1078,7 +1078,7 @@ void log_access( const char *fmt, ... ) {
1078
// ----------------------------------------------------------------------------
1079
// health log
1080
1081
-void log_health( const char *fmt, ... ) {
1081
+void netdata_log_health( const char *fmt, ... ) {
1082
va_list args;
1083
1084
if(health_log_syslog) {
libnetdata/log/log.h
+2
-2
@@ -134,8 +134,8 @@ void info_int( int is_collector, const char *file, const char *function, const u
134
void error_int( int is_collector, const char *prefix, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(6, 7);
135
void error_limit_int(ERROR_LIMIT *erl, const char *prefix, const char *file __maybe_unused, const char *function __maybe_unused, unsigned long line __maybe_unused, const char *fmt, ... ) PRINTFLIKE(6, 7);;
136
void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) NORETURN PRINTFLIKE(4, 5);
137
-void log_access( const char *fmt, ... ) PRINTFLIKE(1, 2);
138
-void log_health( const char *fmt, ... ) PRINTFLIKE(1, 2);
137
+void netdata_log_access( const char *fmt, ... ) PRINTFLIKE(1, 2);
138
+void netdata_log_health( const char *fmt, ... ) PRINTFLIKE(1, 2);
139
140
#ifdef ENABLE_ACLK
141
void log_aclk_message_bin( const char *data, const size_t data_len, int tx, const char *mqtt_topic, const char *message_name);
streaming/receiver.c
+1
-1
@@ -404,7 +404,7 @@ static bool rrdhost_set_receiver(RRDHOST *host, struct receiver_state *rpt) {
404
if (rpt->config.health_enabled != CONFIG_BOOLEAN_NO) {
405
if (rpt->config.alarms_delay > 0) {
406
host->health.health_delay_up_to = now_realtime_sec() + rpt->config.alarms_delay;
407
- log_health(
407
+ netdata_log_health(
408
"[%s]: Postponing health checks for %" PRId64 " seconds, because it was just connected.",
409
rrdhost_hostname(host),
410
(int64_t) rpt->config.alarms_delay);
streaming/rrdpush.c
+1
-1
@@ -715,7 +715,7 @@ void rrdpush_sender_thread_stop(RRDHOST *host, STREAM_HANDSHAKE reason, bool wai
715
// rrdpush receiver thread
716
717
void log_stream_connection(const char *client_ip, const char *client_port, const char *api_key, const char *machine_guid, const char *host, const char *msg) {
718
- log_access("STREAM: %d '[%s]:%s' '%s' host '%s' api key '%s' machine guid '%s'", gettid(), client_ip, client_port, msg, host, api_key, machine_guid);
718
+ netdata_log_access("STREAM: %d '[%s]:%s' '%s' host '%s' api key '%s' machine guid '%s'", gettid(), client_ip, client_port, msg, host, api_key, machine_guid);
719
}
720
721
streaming/sender.c
+1
-1
@@ -944,7 +944,7 @@ void execute_commands(struct sender_state *s) {
944
while( start < end && (newline = strchr(start, '\n')) ) {
945
*newline = '\0';
946
947
- log_access("STREAM: %d from '%s' for host '%s': %s",
947
+ netdata_log_access("STREAM: %d from '%s' for host '%s': %s",
948
gettid(), s->connected_to, rrdhost_hostname(s->host), start);
949
950
// internal_error(true, "STREAM %s [send to %s] received command over connection: %s", rrdhost_hostname(s->host), s->connected_to, start);
web/api/queries/query.c
+2
-2
@@ -3685,12 +3685,12 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3685
bool cancel = false;
3686
if (qt->request.interrupt_callback && qt->request.interrupt_callback(qt->request.interrupt_callback_data)) {
3687
cancel = true;
3688
- log_access("QUERY INTERRUPTED");
3688
+ netdata_log_access("QUERY INTERRUPTED");
3689
}
3690
3691
if (qt->request.timeout_ms && ((NETDATA_DOUBLE)(now_ut - qt->timings.received_ut) / 1000.0) > (NETDATA_DOUBLE)qt->request.timeout_ms) {
3692
cancel = true;
3693
- log_access("QUERY CANCELED RUNTIME EXCEEDED %0.2f ms (LIMIT %lld ms)",
3693
+ netdata_log_access("QUERY CANCELED RUNTIME EXCEEDED %0.2f ms (LIMIT %lld ms)",
3694
(NETDATA_DOUBLE)(now_ut - qt->timings.received_ut) / 1000.0, (long long)qt->request.timeout_ms);
3695
}
3696
web/rtc/webrtc.c
+8
-8
@@ -347,7 +347,7 @@ static void webrtc_execute_api_request(WEBRTC_DC *chan, const char *request, siz
347
348
cleanup:
349
now_monotonic_high_precision_timeval(&tv);
350
- log_access("%llu: %d '[RTC]:%d:%d' '%s' (sent/all = %zu/%zu bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %d '%s'",
350
+ netdata_log_access("%llu: %d '[RTC]:%d:%d' '%s' (sent/all = %zu/%zu bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %d '%s'",
351
w->id
352
, gettid()
353
, chan->conn->pc, chan->dc
@@ -373,7 +373,7 @@ static void myOpenCallback(int id __maybe_unused, void *user_ptr) {
373
WEBRTC_DC *chan = user_ptr;
374
internal_fatal(chan->dc != id, "WEBRTC[%d],DC[%d]: dc mismatch, expected %d, got %d", chan->conn->pc, chan->dc, chan->dc, id);
375
376
- log_access("WEBRTC[%d],DC[%d]: %d DATA CHANNEL '%s' OPEN", chan->conn->pc, chan->dc, gettid(), chan->label);
376
+ netdata_log_access("WEBRTC[%d],DC[%d]: %d DATA CHANNEL '%s' OPEN", chan->conn->pc, chan->dc, gettid(), chan->label);
377
internal_error(true, "WEBRTC[%d],DC[%d]: data channel opened.", chan->conn->pc, chan->dc);
378
chan->open = true;
379
}
@@ -391,7 +391,7 @@ static void myClosedCallback(int id __maybe_unused, void *user_ptr) {
391
DOUBLE_LINKED_LIST_REMOVE_ITEM_UNSAFE(chan->conn->channels.head, chan, link.prev, link.next);
392
spinlock_unlock(&chan->conn->channels.spinlock);
393
394
- log_access("WEBRTC[%d],DC[%d]: %d DATA CHANNEL '%s' CLOSED", chan->conn->pc, chan->dc, gettid(), chan->label);
394
+ netdata_log_access("WEBRTC[%d],DC[%d]: %d DATA CHANNEL '%s' CLOSED", chan->conn->pc, chan->dc, gettid(), chan->label);
395
396
freez(chan->label);
397
freez(chan);
@@ -573,27 +573,27 @@ static void myStateChangeCallback(int pc __maybe_unused, rtcState state, void *u
573
break;
574
575
case RTC_CONNECTING:
576
- log_access("WEBRTC[%d]: %d CONNECTING", conn->pc, gettid());
576
+ netdata_log_access("WEBRTC[%d]: %d CONNECTING", conn->pc, gettid());
577
internal_error(true, "WEBRTC[%d]: connecting...", conn->pc);
578
break;
579
580
case RTC_CONNECTED:
581
- log_access("WEBRTC[%d]: %d CONNECTED", conn->pc, gettid());
581
+ netdata_log_access("WEBRTC[%d]: %d CONNECTED", conn->pc, gettid());
582
internal_error(true, "WEBRTC[%d]: connected!", conn->pc);
583
break;
584
585
case RTC_DISCONNECTED:
586
- log_access("WEBRTC[%d]: %d DISCONNECTED", conn->pc, gettid());
586
+ netdata_log_access("WEBRTC[%d]: %d DISCONNECTED", conn->pc, gettid());
587
internal_error(true, "WEBRTC[%d]: disconnected.", conn->pc);
588
break;
589
590
case RTC_FAILED:
591
- log_access("WEBRTC[%d]: %d CONNECTION FAILED", conn->pc, gettid());
591
+ netdata_log_access("WEBRTC[%d]: %d CONNECTION FAILED", conn->pc, gettid());
592
internal_error(true, "WEBRTC[%d]: failed.", conn->pc);
593
break;
594
595
case RTC_CLOSED:
596
- log_access("WEBRTC[%d]: %d CONNECTION CLOSED", conn->pc, gettid());
596
+ netdata_log_access("WEBRTC[%d]: %d CONNECTION CLOSED", conn->pc, gettid());
597
internal_error(true, "WEBRTC[%d]: closed.", conn->pc);
598
spinlock_lock(&webrtc_base.unsafe.spinlock);
599
webrtc_destroy_connection_unsafe(conn);
web/server/h2o/http_server.c
+2
-2
@@ -239,7 +239,7 @@ static int netdata_uberhandler(h2o_handler_t *self, h2o_req_t *req)
239
uuid_unparse_lower(host->host_uuid, host_uuid_str);
240
241
if (!ret) {
242
- log_access("HTTPD OK method: " PRINTF_H2O_IOVEC_FMT
242
+ netdata_log_access("HTTPD OK method: " PRINTF_H2O_IOVEC_FMT
243
", path: " PRINTF_H2O_IOVEC_FMT
244
", as host: %s"
245
", response: %d",
@@ -248,7 +248,7 @@ static int netdata_uberhandler(h2o_handler_t *self, h2o_req_t *req)
248
host == localhost ? "localhost" : host_uuid_str,
249
req->res.status);
250
} else {
251
- log_access("HTTPD %d"
251
+ netdata_log_access("HTTPD %d"
252
" method: " PRINTF_H2O_IOVEC_FMT
253
", path: " PRINTF_H2O_IOVEC_FMT
254
", forwarding to file handler as path: " PRINTF_H2O_IOVEC_FMT,
web/server/web_client.c
+1
-1
@@ -214,7 +214,7 @@ void web_client_request_done(struct web_client *w) {
214
}
215
216
// access log
217
- log_access("%llu: %d '[%s]:%s' '%s' (sent/all = %zu/%zu bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %d '%s'",
217
+ netdata_log_access("%llu: %d '[%s]:%s' '%s' (sent/all = %zu/%zu bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %d '%s'",
218
w->id
219
, gettid()
220
, w->client_ip
web/server/web_server.c
+1
-1
@@ -130,5 +130,5 @@ void web_client_update_acl_matches(struct web_client *w) {
130
// --------------------------------------------------------------------------------------
131
132
void web_server_log_connection(struct web_client *w, const char *msg) {
133
- log_access("%llu: %d '[%s]:%s' '%s'", w->id, gettid(), w->client_ip, w->client_port, msg);
133
+ netdata_log_access("%llu: %d '[%s]:%s' '%s'", w->id, gettid(), w->client_ip, w->client_port, msg);
134
}