Skip to content

Commit 9bc72be

Browse files
make receive_timeout configurable (#96)
1 parent eaa1623 commit 9bc72be

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Configuration options for fluent.conf are:
2828
* json_merge - Same as json but merge content of `log_key` into the top level and strip `log_key`
2929
* `log_key` - Used to specify the key when merging json or sending logs in text format (default `message`)
3030
* `open_timeout` - Set timeout seconds to wait until connection is opened.
31+
* `receieve_timeout` - Set timeout seconds to wait for a response from SumoLogic in seconds. Don't modify unless you see `HTTPClient::ReceiveTimeoutError` in your Fluentd logs.
3132
* `send_timeout` - Timeout for sending to SumoLogic in seconds. Don't modify unless you see `HTTPClient::SendTimeoutError` in your Fluentd logs. (default `120`)
3233
* `add_timestamp` - Add `timestamp` (or `timestamp_key`) field to logs before sending to sumologic (default `true`)
3334
* `timestamp_key` - Field name when `add_timestamp` is on (default `timestamp`)

lib/fluent/plugin/out_sumologic.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ class SumologicConnection
1313
COMPRESS_DEFLATE = 'deflate'
1414
COMPRESS_GZIP = 'gzip'
1515

16-
def initialize(endpoint, verify_ssl, connect_timeout, send_timeout, proxy_uri, disable_cookies, sumo_client, compress_enabled, compress_encoding, logger)
16+
def initialize(endpoint, verify_ssl, connect_timeout, receive_timeout, send_timeout, proxy_uri, disable_cookies, sumo_client, compress_enabled, compress_encoding, logger)
1717
@endpoint = endpoint
1818
@sumo_client = sumo_client
19-
create_http_client(verify_ssl, connect_timeout, send_timeout, proxy_uri, disable_cookies)
19+
create_http_client(verify_ssl, connect_timeout, receive_timeout, send_timeout, proxy_uri, disable_cookies)
2020
@compress = compress_enabled
2121
@compress_encoding = (compress_encoding ||= COMPRESS_GZIP).downcase
2222
@logger = logger
@@ -94,10 +94,11 @@ def ssl_options(verify_ssl)
9494
verify_ssl==true ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
9595
end
9696

97-
def create_http_client(verify_ssl, connect_timeout, send_timeout, proxy_uri, disable_cookies)
97+
def create_http_client(verify_ssl, connect_timeout, receive_timeout, send_timeout, proxy_uri, disable_cookies)
9898
@http = HTTPClient.new(proxy_uri)
9999
@http.ssl_config.verify_mode = ssl_options(verify_ssl)
100100
@http.connect_timeout = connect_timeout
101+
@http.receive_timeout = receive_timeout
101102
@http.send_timeout = send_timeout
102103
if disable_cookies
103104
@http.cookie_manager = nil
@@ -152,6 +153,7 @@ class Fluent::Plugin::Sumologic < Fluent::Plugin::Output
152153
config_param :verify_ssl, :bool, :default => true
153154
config_param :delimiter, :string, :default => "."
154155
config_param :open_timeout, :integer, :default => 60
156+
config_param :receive_timeout, :integer, :default => 60
155157
config_param :send_timeout, :integer, :default => 120
156158
config_param :add_timestamp, :bool, :default => true
157159
config_param :timestamp_key, :string, :default => 'timestamp'
@@ -232,6 +234,7 @@ def configure(conf)
232234
@endpoint,
233235
@verify_ssl,
234236
@open_timeout,
237+
@receive_timeout,
235238
@send_timeout,
236239
@proxy_uri,
237240
@disable_cookies,

0 commit comments

Comments
 (0)