From 79ee5014eb6000ab9e86404020bb7cf335479ebe Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Wed, 10 Feb 2021 18:23:18 +0100 Subject: [PATCH] fixes for openbsd --- sink/logging.c | 2 +- sink/sink20169.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sink/logging.c b/sink/logging.c index ca5de56..d8ab01e 100644 --- a/sink/logging.c +++ b/sink/logging.c @@ -7,7 +7,7 @@ void logmsg(int prio, const char* format, ...) { va_list vl; - openlog("counter", 0, LOG_LOCAL0); + openlog("counter", 0, LOG_LOCAL1); va_start(vl, format); vsyslog(prio, format, vl); //vprintf(format, vl); diff --git a/sink/sink20169.c b/sink/sink20169.c index f78709a..1a0854e 100644 --- a/sink/sink20169.c +++ b/sink/sink20169.c @@ -267,14 +267,14 @@ int forwardMinuteBuffer(t_forwarderHandle *handle, t_minuteBuffer *buf) { const char *location = device->location; for (uint8_t j = 0; j < SECONDS_PER_MINUTE; j++) { - logmsg(LOG_INFO, "Time: %lu, Frequency: %u", buf->s.events[j].timestamp, buf->s.events[j].frequency); + logmsg(LOG_DEBUG, "Time: %lu, Frequency: %u", buf->s.events[j].timestamp, buf->s.events[j].frequency); int frequency_before_point = buf->s.events[j].frequency / 1000; int frequency_behind_point = buf->s.events[j].frequency - (frequency_before_point * 1000); char payload[256]; int res = snprintf(payload, sizeof(payload), - "%s,valid=1,location=%s,host=%s freq=%d.%03d %lu", + "%s,valid=1,location=%s,host=%s freq=%d.%03d %llu", handle->influxMeasurement, location, buf->s.deviceId, frequency_before_point, frequency_behind_point, buf->s.events[j].timestamp); @@ -282,13 +282,14 @@ int forwardMinuteBuffer(t_forwarderHandle *handle, t_minuteBuffer *buf) { logmsg(LOG_ERR, "payload buffer to small"); return -1; } - logmsg(LOG_INFO, "Payload: %s", payload); + logmsg(LOG_DEBUG, "Payload: %s", payload); res = httpPostRequest(handle->influxUrl, handle->influxUser, handle->influxPass, payload); if (res == 0) { - logmsg(LOG_INFO, "Successfully sent to InfluxDB"); + logmsg(LOG_DEBUG, "Successfully sent to InfluxDB"); } } + logmsg(LOG_INFO, "Successfully sent whole minute to InfluxDB"); return 0; }