diff --git a/src/probes/journal.c b/src/probes/journal.c index d8246fc..139d85a 100644 --- a/src/probes/journal.c +++ b/src/probes/journal.c @@ -122,6 +122,16 @@ static int read_new_entries(sd_journal *journal) add_to_payload(data, length); + // For now, we send one record per log message, in case the + // there is a large backlog of messages and we exceed the + // payload size limit (8KB). And ignore errors, hoping that it's + // a transient problem. + + if (!send_data(error_class)) { + telem_log(LOG_ERR, "Failed to send data. Ignoring.\n"); + return num_entries; + } + num_entries++; } @@ -151,17 +161,11 @@ static bool process_existing_entries(sd_journal *journal) ret = read_new_entries(journal); if (ret < 0) { return false; - } - - if (!payload) { + } else if (ret == 0) { telem_log(LOG_DEBUG, "No existing entries found\n"); return true; } - if (!send_data(error_class)) { - return false; - } - return true; } @@ -278,10 +282,6 @@ static bool process_journal(void) } else if (r < 0) { return false; } - - if (!send_data(error_class)) { - return false; - } } } }