Skip to content

Commit

Permalink
1.3.2 (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana authored Mar 24, 2023
1 parent 74f46a7 commit 9539d65
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
fluent-plugin-splunk-hec (1.3.1)
fluent-plugin-splunk-hec (1.3.2)
fluentd (>= 1.5)
json-jwt (~> 1.15.0)
multi_json (~> 1.13)
Expand All @@ -13,9 +13,9 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activemodel (7.0.4)
activesupport (= 7.0.4)
activesupport (7.0.4)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -25,7 +25,7 @@ GEM
aes_key_wrap (1.1.0)
attr_required (1.0.1)
bindata (2.4.14)
concurrent-ruby (1.1.10)
concurrent-ruby (1.2.2)
connection_pool (2.3.0)
cool.io (1.7.1)
crack (0.4.5)
Expand Down Expand Up @@ -89,7 +89,7 @@ GEM
power_assert (2.0.1)
prometheus-client (4.0.0)
public_suffix (4.0.6)
rack (3.0.1)
rack (3.0.6.1)
rack-oauth2 (1.21.2)
activesupport
attr_required
Expand Down Expand Up @@ -117,7 +117,7 @@ GEM
test-unit (3.5.3)
power_assert
timeout (0.2.0)
tzinfo (2.0.5)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2022.6)
tzinfo (>= 1.0.0)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# End of Support

**Important:** The fluent-plugin-splunk-hec will reach End of Support on January 1, 2024. After that date, this repository will no longer receive updates from Splunk and will no longer be supported by Splunk. Until then, only critical security fixes and bug fixes will be provided.

# fluent-plugin-splunk-hec

[Fluentd](https://fluentd.org/) output plugin to send events and metrics to [Splunk](https://www.splunk.com) in 2 modes:<br/>
Expand Down Expand Up @@ -288,6 +292,10 @@ Splunk app name using this plugin (default to `hec_plugin_gem`)

The version of Splunk app using this this plugin (default to plugin version)

### custom_headers (Hash) (Optional)

Hash of custom headers to be added to the HTTP request. Used to populate [`override_headers`](https://docs.seattlerb.org/net-http-persistent/Net/HTTP/Persistent.html#attribute-i-override_headers) attribute of the underlying `Net::HTTP::Persistent` connection.

#### When `data_type` is `event`

In this case, parameters inside `<fields>` are used as indexed fields and removed from the original input events. Please see the "Add a "fields" property at the top JSON level" [here](http://dev.splunk.com/view/event-collector/SP-CAAAFB6) for details. Given we have configuration like
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.1
1.3.2
2 changes: 1 addition & 1 deletion docker/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GIT
PATH
remote: gem
specs:
fluent-plugin-splunk-hec (1.3.1)
fluent-plugin-splunk-hec (1.3.2)
fluentd (>= 1.5)
json-jwt (~> 1.15.0)
multi_json (~> 1.13)
Expand Down
7 changes: 6 additions & 1 deletion lib/fluent/plugin/out_splunk_hec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ class SplunkHecOutput < SplunkOutput
DESC
config_param :non_utf8_replacement_string, :string, :default => ' '

desc 'Any custom headers to include alongside requests made to Splunk'
config_param :custom_headers, :hash, :default => {}

def initialize
super
@default_host = Socket.gethostname
Expand Down Expand Up @@ -168,7 +171,9 @@ def start
c.override_headers['Authorization'] = "Splunk #{@hec_token}"
c.override_headers['__splunk_app_name'] = "#{@app_name}"
c.override_headers['__splunk_app_version'] = "#{@app_version}"

@custom_headers.each do |header, value|
c.override_headers[header] = value
end
end
end

Expand Down
7 changes: 7 additions & 0 deletions test/fluent/plugin/out_splunk_hec_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@
it 'should support enabling gzip' do
expect(create_hec_output_driver('hec_host hec_token', 'gzip_compression true').instance.gzip_compression).must_equal true
end
it 'should define custom_headers as {} (hash) initially' do
assert_empty(create_hec_output_driver('hec_host hec_token').instance.custom_headers)
expect(create_hec_output_driver('hec_host hec_token').instance.custom_headers).is_a? Hash
end
it 'should allow setting custom_headers' do
assert_equal(create_hec_output_driver('hec_host hec_token', 'custom_headers {"custom":"header"}').instance.custom_headers, {"custom" => "header"})
end
end

describe 'hec_host validation' do
Expand Down

0 comments on commit 9539d65

Please sign in to comment.