@@ -7,8 +7,9 @@ class SumologicConnection
77
88 attr_reader :http
99
10- def initialize ( endpoint , verify_ssl , connect_timeout , proxy_uri , disable_cookies )
10+ def initialize ( endpoint , verify_ssl , connect_timeout , proxy_uri , disable_cookies , sumo_client )
1111 @endpoint = endpoint
12+ @sumo_client = sumo_client
1213 create_http_client ( verify_ssl , connect_timeout , proxy_uri , disable_cookies )
1314 end
1415
@@ -24,7 +25,7 @@ def request_headers(source_host, source_category, source_name, data_type, metric
2425 'X-Sumo-Name' => source_name ,
2526 'X-Sumo-Category' => source_category ,
2627 'X-Sumo-Host' => source_host ,
27- 'X-Sumo-Client' => 'fluentd-output'
28+ 'X-Sumo-Client' => @sumo_client ,
2829 }
2930 if data_type == 'metrics'
3031 case metric_data_format
@@ -89,6 +90,8 @@ class Fluent::Plugin::Sumologic < Fluent::Plugin::Output
8990 # https://help.sumologic.com/Manage/Fields
9091 desc 'Fields string (eg "cluster=payment, service=credit_card") which is going to be added to every record.'
9192 config_param :custom_fields , :string , :default => nil
93+ desc 'Name of sumo client which is send as X-Sumo-Client header'
94+ config_param :sumo_client , :string , :default => 'fluentd-output'
9295
9396 config_section :buffer do
9497 config_set_default :@type , DEFAULT_BUFFER_TYPE
@@ -136,7 +139,19 @@ def configure(conf)
136139 conf [ 'custom_fields' ] = nil
137140 end
138141
139- @sumo_conn = SumologicConnection . new ( conf [ 'endpoint' ] , conf [ 'verify_ssl' ] , conf [ 'open_timeout' ] . to_i , conf [ 'proxy_uri' ] , conf [ 'disable_cookies' ] )
142+ # For some reason default is set incorrectly in unit-tests
143+ if conf [ 'sumo_client' ] . nil? || conf [ 'sumo_client' ] . strip . length == 0
144+ conf [ 'sumo_client' ] = 'fluentd-output'
145+ end
146+
147+ @sumo_conn = SumologicConnection . new (
148+ conf [ 'endpoint' ] ,
149+ conf [ 'verify_ssl' ] ,
150+ conf [ 'open_timeout' ] . to_i ,
151+ conf [ 'proxy_uri' ] ,
152+ conf [ 'disable_cookies' ] ,
153+ conf [ 'sumo_client' ]
154+ )
140155 super
141156 end
142157
0 commit comments