Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose httpclient send_timeout #68

Merged
merged 2 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
* `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.
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 @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'],
Expand Down