lib/fluent/plugin/out_indicative.rb in fluent-plugin-indicative-0.1.0 vs lib/fluent/plugin/out_indicative.rb in fluent-plugin-indicative-0.1.1

- old
+ new

@@ -1,5 +1,6 @@ +require 'date' require 'net/http' require 'net/https' require 'uri' require 'fluent/plugin/output' @@ -42,15 +43,19 @@ payload = { apiKey: @api_key, eventName: data[@event_name_key], eventUniqueId: unique_id_key && data[unique_id_key], properties: flatten_hash(data), - eventTime: data[@event_time_key] + eventTime: Date.parse(data[@event_time_key]).rfc3339 } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri, headers) request.body = payload.to_json response = http.request(request) + + if response.code != 200 + log.warn("Indicative responded with error: #{response.body} for #{payload.to_json}") + end end end