fluent-plugin-elasticsearch 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 848660aa041feaaebb21f90db0da0a9e2e4b5dc912ba83c58d452607f9d1e982
4
- data.tar.gz: e2c4dfedd7458cab2146b5e3939720b2fca6ce69d58be2ffbe0cc966929a2943
3
+ metadata.gz: 75885bc5381810a40869a729ac3a7b6987f94b5083aad30e2111778982d239d7
4
+ data.tar.gz: a07a3c9a043e21d638b1b2cab1faa8746cead0b4757690553a34ffd7058e1442
5
5
  SHA512:
6
- metadata.gz: 4addc8de17edeb5b1a698d21180e314789e56284576f37eed8d645d6af5bc9f7afe310fed1c16f9d63b68683d005364e0bc18324984a9029d120fcde5ee05c1d
7
- data.tar.gz: 83dd202ec5ec3ad1d1cbffd14e5cdb49e90e84ec764d129a7b45fa080fa5646e56b0363241fc6cf9a0f4c7403fa43812ae45137e6499cb3014e8f84e0629d9d5
6
+ metadata.gz: ea912aa3c8d707a3490cb30ba4ae01f8a071e699525957a765bd084f34077d2f9f7564232b2372645ca3fc9eb46e408ecd6bb6f42e06d19e276be9bd10d3b129
7
+ data.tar.gz: 3f6b3eceaa5da555fa58c1718a7c43fbe2cb61957e771058605f5956d618874fccc6f6330eb48314808529f50175bed5facb76f10e0f4a501c0677db9871ca86
data/Gemfile CHANGED
@@ -6,3 +6,4 @@ gemspec
6
6
  gem 'simplecov', require: false
7
7
  gem 'coveralls', require: false
8
8
  gem 'strptime', require: false if RUBY_ENGINE == "ruby" && RUBY_VERSION =~ /^2/
9
+ gem "irb" if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.6"
data/History.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 3.1.1
6
+ - Add document for custom_headers (#538)
7
+ - out_elasticsearch: Add custom_headers parameter (#529)
8
+ - Bundle irb on Ruby 2.6 or later (#537)
9
+
5
10
  ### 3.1.0
6
11
  - Retry obtaining Elasticsearch version (#532)
7
12
  - Fix broken id links (#530)
data/README.md CHANGED
@@ -74,6 +74,7 @@ Current maintainers: @cosmo0920
74
74
  + [unrecoverable_error_types](#unrecoverable-error-types)
75
75
  + [verify_es version at startup](#verify_es_version_at_startup)
76
76
  + [default_elasticsearch_version](#default_elasticsearch_version)
77
+ + [custom_headers](#custom_headers)
77
78
  + [Not seeing a config you need?](#not-seeing-a-config-you-need)
78
79
  + [Dynamic configuration](#dynamic-configuration)
79
80
  + [Placeholders](#placeholders)
@@ -896,6 +897,14 @@ The default value is `true`.
896
897
 
897
898
  This parameter changes that ES plugin assumes default Elasticsearch version. The default value is `5`.
898
899
 
900
+ ### custom_headers
901
+
902
+ This parameter adds additional headers to request. The default value is `{}`.
903
+
904
+ ```
905
+ custom_headers {"token":"secret"}
906
+ ```
907
+
899
908
  ### Not seeing a config you need?
900
909
 
901
910
  We try to keep the scope of this plugin small and not add too many configuration options. If you think an option would be useful to others, feel free to open an issue or contribute a Pull Request.
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'fluent-plugin-elasticsearch'
6
- s.version = '3.1.0'
6
+ s.version = '3.1.1'
7
7
  s.authors = ['diogo', 'pitr']
8
8
  s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com']
9
9
  s.description = %q{Elasticsearch output plugin for Fluent event collector}
@@ -130,6 +130,7 @@ EOC
130
130
  config_param :verify_es_version_at_startup, :bool, :default => true
131
131
  config_param :default_elasticsearch_version, :integer, :default => DEFAULT_ELASTICSEARCH_VERSION
132
132
  config_param :log_es_400_reason, :bool, :default => false
133
+ config_param :custom_headers, :hash, :default => {}
133
134
 
134
135
  config_section :buffer do
135
136
  config_set_default :@type, DEFAULT_BUFFER_TYPE
@@ -350,6 +351,7 @@ EOC
350
351
  if local_reload_connections && @reload_after > DEFAULT_RELOAD_AFTER
351
352
  local_reload_connections = @reload_after
352
353
  end
354
+ headers = { 'Content-Type' => @content_type.to_s }.merge(@custom_headers)
353
355
  transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new(get_connection_options.merge(
354
356
  options: {
355
357
  reload_connections: local_reload_connections,
@@ -357,7 +359,7 @@ EOC
357
359
  resurrect_after: @resurrect_after,
358
360
  logger: @transport_logger,
359
361
  transport_options: {
360
- headers: { 'Content-Type' => @content_type.to_s },
362
+ headers: headers,
361
363
  request: { timeout: @request_timeout },
362
364
  ssl: { verify: @ssl_verify, ca_file: @ca_file, version: @ssl_version }
363
365
  },
@@ -966,6 +966,18 @@ class ElasticsearchOutput < Test::Unit::TestCase
966
966
  assert_requested(elastic_request)
967
967
  end
968
968
 
969
+ def test_custom_headers
970
+ stub_request(:head, "http://localhost:9200/").
971
+ to_return(:status => 200, :body => "", :headers => {})
972
+ elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
973
+ with(headers: {'custom' => 'header1','and_others' => 'header2' })
974
+ driver.configure(%[custom_headers {"custom":"header1", "and_others":"header2"}])
975
+ driver.run(default_tag: 'test') do
976
+ driver.feed(sample_record)
977
+ end
978
+ assert_requested(elastic_request)
979
+ end
980
+
969
981
  def test_write_message_with_bad_chunk
970
982
  driver.configure("target_index_key bad_value\n@log_level debug\n")
971
983
  stub_elastic
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - diogo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-22 00:00:00.000000000 Z
12
+ date: 2019-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd