summaryrefslogtreecommitdiffstats
path: root/health/health_log.c
diff options
context:
space:
mode:
Diffstat (limited to 'health/health_log.c')
-rw-r--r--health/health_log.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/health/health_log.c b/health/health_log.c
index 54f6dc9fc4..6603a9d61e 100644
--- a/health/health_log.c
+++ b/health/health_log.c
@@ -74,28 +74,15 @@ inline void health_label_log_save(RRDHOST *host) {
if(unlikely(host->health_log_fp)) {
BUFFER *wb = buffer_create(1024);
- rrdhost_check_rdlock(host);
- netdata_rwlock_rdlock(&host->labels.labels_rwlock);
- struct label *l=localhost->labels.head;
- while (l != NULL) {
- buffer_sprintf(wb,"%s=%s\t ", l->key, l->value);
- l = l->next;
- }
- netdata_rwlock_unlock(&host->labels.labels_rwlock);
-
- char *write = (char *) buffer_tostring(wb) ;
- write[wb->len-2] = '\n';
- write[wb->len-1] = '\0';
+ rrdlabels_to_buffer(localhost->host_labels, wb, "", "=", "", "\t ", NULL, NULL, NULL, NULL);
+ char *write = (char *) buffer_tostring(wb);
- if (unlikely(fprintf(host->health_log_fp, "L\t%s"
- , write
- ) < 0))
+ if (unlikely(fprintf(host->health_log_fp, "L\t%s", write) < 0))
error("HEALTH [%s]: failed to save alarm log entry to '%s'. Health data may be lost in case of abnormal restart.",
host->hostname, host->health_log_filename);
- else {
+ else
host->health_log_entries_written++;
- }
buffer_free(wb);
}