abramovic/logrus_influxdb

Any syntactically bad log statement will fail every other log message forever

Closed this issue · 2 comments

I plan to submit a patch to address this tomorrow, but I wanted to report my findings today.

Short version of the story: the log buffer (batchP) is only cleared upon a successful Write to InfluxDB. This means that if a single bad statement is written, then the buffer will continue to fill and never be cleared, causing every log statement to attempt to send an ever-increasing buffer of logs to InfluxDB.

This can happen for silly, simple reasons:

  1. Someone logged WithField X of type float and you try to log WithField X of type integer. That will always fail until the InfluxDB database is cleared.
  2. You accidentally log a uint64 value, and the InfluxDB client supports encoding this as XXXu but the InfluxDB server does not (as of version 1.5.3) support parsing this value.

In both of these cases, the application that is logging will gradually slow down and die.

My proposed fix is to have writePoints always clear the buffer (batchP) and update lastBatchUpdate, and then just return an error if there happened to be one when writing.

👍

I submitted #24 to address this.