Skip to content

Commit

Permalink
make receive_timeout configurable (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwang13 authored Oct 3, 2024
1 parent eaa1623 commit 9bc72be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* `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.
* `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`)
Expand Down
9 changes: 6 additions & 3 deletions lib/fluent/plugin/out_sumologic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class SumologicConnection
COMPRESS_DEFLATE = 'deflate'
COMPRESS_GZIP = 'gzip'

def initialize(endpoint, verify_ssl, connect_timeout, send_timeout, proxy_uri, disable_cookies, sumo_client, compress_enabled, compress_encoding, logger)
def initialize(endpoint, verify_ssl, connect_timeout, receive_timeout, send_timeout, proxy_uri, disable_cookies, sumo_client, compress_enabled, compress_encoding, logger)
@endpoint = endpoint
@sumo_client = sumo_client
create_http_client(verify_ssl, connect_timeout, send_timeout, proxy_uri, disable_cookies)
create_http_client(verify_ssl, connect_timeout, receive_timeout, send_timeout, proxy_uri, disable_cookies)
@compress = compress_enabled
@compress_encoding = (compress_encoding ||= COMPRESS_GZIP).downcase
@logger = logger
Expand Down Expand Up @@ -94,10 +94,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, send_timeout, proxy_uri, disable_cookies)
def create_http_client(verify_ssl, connect_timeout, receive_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.receive_timeout = receive_timeout
@http.send_timeout = send_timeout
if disable_cookies
@http.cookie_manager = nil
Expand Down Expand Up @@ -152,6 +153,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 :receive_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'
Expand Down Expand Up @@ -232,6 +234,7 @@ def configure(conf)
@endpoint,
@verify_ssl,
@open_timeout,
@receive_timeout,
@send_timeout,
@proxy_uri,
@disable_cookies,
Expand Down

0 comments on commit 9bc72be

Please sign in to comment.