From 9406fb9bf2a0ab3da5cabc487ecf7185dd7f7d19 Mon Sep 17 00:00:00 2001 From: Reilly Brogan Date: Tue, 20 Jul 2021 11:39:29 -0500 Subject: [PATCH 1/2] Expose httpclient send_timeout --- lib/fluent/plugin/out_sumologic.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/fluent/plugin/out_sumologic.rb b/lib/fluent/plugin/out_sumologic.rb index 450a181..9de2925 100644 --- a/lib/fluent/plugin/out_sumologic.rb +++ b/lib/fluent/plugin/out_sumologic.rb @@ -12,10 +12,10 @@ class SumologicConnection COMPRESS_DEFLATE = 'deflate' COMPRESS_GZIP = 'gzip' - def initialize(endpoint, verify_ssl, connect_timeout, proxy_uri, disable_cookies, sumo_client, compress_enabled, compress_encoding) + def initialize(endpoint, verify_ssl, connect_timeout, send_timeout, proxy_uri, disable_cookies, sumo_client, compress_enabled, compress_encoding) @endpoint = endpoint @sumo_client = sumo_client - create_http_client(verify_ssl, connect_timeout, proxy_uri, disable_cookies) + create_http_client(verify_ssl, connect_timeout, send_timeout, proxy_uri, disable_cookies) @compress = compress_enabled @compress_encoding = (compress_encoding ||= COMPRESS_GZIP).downcase @@ -69,10 +69,11 @@ def ssl_options(verify_ssl) verify_ssl==true ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE end - def create_http_client(verify_ssl, connect_timeout, proxy_uri, disable_cookies) + def create_http_client(verify_ssl, connect_timeout, send_timeout, proxy_uri, disable_cookies) @http = HTTPClient.new(proxy_uri) @http.ssl_config.verify_mode = ssl_options(verify_ssl) @http.connect_timeout = connect_timeout + @http.send_timeout = send_timeout if disable_cookies @http.cookie_manager = nil end @@ -126,6 +127,7 @@ class Fluent::Plugin::Sumologic < Fluent::Plugin::Output config_param :verify_ssl, :bool, :default => true config_param :delimiter, :string, :default => "." config_param :open_timeout, :integer, :default => 60 + config_param :send_timeout, :integer, :default => 120 config_param :add_timestamp, :bool, :default => true config_param :timestamp_key, :string, :default => 'timestamp' config_param :proxy_uri, :string, :default => nil @@ -210,6 +212,7 @@ def configure(conf) conf['endpoint'], conf['verify_ssl'], conf['open_timeout'].to_i, + conf['send_timeout'].to_i, conf['proxy_uri'], conf['disable_cookies'], conf['sumo_client'], From 05bcf2a42894685f7285f85ba7eb73002048b3e8 Mon Sep 17 00:00:00 2001 From: Reilly Brogan Date: Wed, 21 Jul 2021 10:17:31 -0500 Subject: [PATCH 2/2] Add send_timeout to readme as well --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 648cebb..846d21a 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Configuration options for fluent.conf are: * json_merge - Same as json but merge content of `log_key` into the top level and strip `log_key` * `log_key` - Used to specify the key when merging json or sending logs in text format (default `message`) * `open_timeout` - Set timeout seconds to wait until connection is opened. +* `send_timeout` - Timeout for sending to SumoLogic in seconds. Don't modify unless you see `HTTPClient::SendTimeoutError` in your Fluentd logs. (default `120`) * `add_timestamp` - Add `timestamp` (or `timestamp_key`) field to logs before sending to sumologic (default `true`) * `timestamp_key` - Field name when `add_timestamp` is on (default `timestamp`) * `proxy_uri` - Add the `uri` of the `proxy` environment if present.