fluent-plugin-elasticsearch 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af3f58b827423bdfc292675d045d0e88f3bcc051
4
- data.tar.gz: 63d6cdcdf4f23cac1c7e932e633df607cc3ac7fd
3
+ metadata.gz: c29f67bc984aa2da3c26d64f4eb8b39a696ec45a
4
+ data.tar.gz: 5c3b38d9a83cce6c3b6dd0c6cfec3cb258b93801
5
5
  SHA512:
6
- metadata.gz: 38fdabbdd290f4d03f5cc26eae8643c8a7e6a922ebf6d294fc46b3b4a085b77155776c6c48c44d9fa4ca03ffbad4e91c0f3587d34999610fa0214d5635d61c1b
7
- data.tar.gz: de3e9167b99936945d290da18400074b9def208d59b6ae01b2a506e644d972d4e5551717f32a77fb969074c6a09c153490ceb940ae88fece749266192d08a45c
6
+ metadata.gz: ab8603053553d60e49b37eefea82d5dab6d6ef051225e4765907de6139d749231b2d7dec145c06d1d72396deadb0c02cccb441f73061e98c20fbe8799a1ee69d
7
+ data.tar.gz: 3c59c0982680b9cb23a50abd6e5d89d5251809047c39ff54371285b93400446a082048ed285c8e56738dca76245b1ef46f50ab395cf07f26dca1e74d6097aeed
data/History.md CHANGED
@@ -4,6 +4,9 @@
4
4
  - Log ES response errors (#230)
5
5
  - Use latest elasticsearch-ruby (#240)
6
6
 
7
+ ### 2.4.0
8
+ - Add built-in placeholders support against type_name parameter (#338)
9
+
7
10
  ### 2.3.0
8
11
  - Allow overwriting existing index template (#239)
9
12
 
@@ -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 = '2.3.0'
6
+ s.version = '2.4.0'
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}
@@ -320,7 +320,8 @@ module Fluent::Plugin
320
320
  def expand_placeholders(metadata)
321
321
  logstash_prefix = extract_placeholders(@logstash_prefix, metadata)
322
322
  index_name = extract_placeholders(@index_name, metadata)
323
- return logstash_prefix, index_name
323
+ type_name = extract_placeholders(@type_name, metadata)
324
+ return logstash_prefix, index_name, type_name
324
325
  end
325
326
 
326
327
  def multi_workers_ready?
@@ -333,7 +334,7 @@ module Fluent::Plugin
333
334
  meta = {}
334
335
 
335
336
  tag = chunk.metadata.tag
336
- logstash_prefix, index_name = expand_placeholders(chunk.metadata)
337
+ logstash_prefix, index_name, type_name = expand_placeholders(chunk.metadata)
337
338
  @error = Fluent::Plugin::ElasticsearchErrorHandler.new(self)
338
339
 
339
340
  chunk.msgpack_each do |time, record|
@@ -384,7 +385,7 @@ module Fluent::Plugin
384
385
  if target_type_parent && target_type_parent[target_type_child_key]
385
386
  target_type = target_type_parent.delete(target_type_child_key)
386
387
  else
387
- target_type = @type_name
388
+ target_type = type_name
388
389
  end
389
390
 
390
391
  meta.clear
@@ -821,6 +821,16 @@ class ElasticsearchOutput < Test::Unit::TestCase
821
821
  assert_equal('mytype', index_cmds.first['index']['_type'])
822
822
  end
823
823
 
824
+ def test_writes_to_speficied_type_with_placeholders
825
+ driver.configure("type_name mytype.${tag}\n")
826
+ stub_elastic_ping
827
+ stub_elastic
828
+ driver.run(default_tag: 'test') do
829
+ driver.feed(sample_record)
830
+ end
831
+ assert_equal('mytype.test', index_cmds.first['index']['_type'])
832
+ end
833
+
824
834
  def test_writes_to_target_type_key
825
835
  driver.configure("target_type_key @target_type\n")
826
836
  stub_elastic_ping
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: 2.3.0
4
+ version: 2.4.0
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: 2017-11-27 00:00:00.000000000 Z
12
+ date: 2017-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd