From c2811154b7df3aff3f415657eb374193e9eb8911 Mon Sep 17 00:00:00 2001 From: Masahiro Nakagawa Date: Fri, 31 Aug 2018 17:25:18 +0900 Subject: [PATCH] Skip empty string because influxdb can't handle it. ref #89 --- lib/fluent/plugin/out_influxdb.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/fluent/plugin/out_influxdb.rb b/lib/fluent/plugin/out_influxdb.rb index 1534399..38a97c4 100644 --- a/lib/fluent/plugin/out_influxdb.rb +++ b/lib/fluent/plugin/out_influxdb.rb @@ -98,12 +98,13 @@ def start end end + EMPTY_STRING = ''.freeze FORMATTED_RESULT_FOR_INVALID_RECORD = ''.freeze def format(tag, time, record) - # TODO: Use tag based chunk separation for more reliability - if record.empty? || record.has_value?(nil) - log.warn "Skip record '#{record}', because either record has no value or at least a value is 'nil' inside the record. " + # nil and '' check should be in influxdb-ruby client... + if record.empty? || record.has_value?(nil) || record.has_value?(EMPTY_STRING) + log.warn "Skip record '#{record}' in '#{tag}', because either record has no value or at least a value is 'nil' inside the record." FORMATTED_RESULT_FOR_INVALID_RECORD else [precision_time(time), record].to_msgpack