fluent-plugin-elasticsearch 2.8.3 → 2.8.4

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: c41a1b3ed19d37587d26b58af1f486d8f9ff5defaa56083e4ec1107e1b5022b8
4
- data.tar.gz: 8e240e97ec2544b86c892c139c6dd713fb0cbcf044a600f03290d03976227de8
3
+ metadata.gz: 99d4765746584010b4516e0578981297209f154490d556a3dc4d03a085cd1322
4
+ data.tar.gz: e2562b75d8728b878ae9d8daadb179a4b362301ac5d124732e6b2e4751ecc0db
5
5
  SHA512:
6
- metadata.gz: d56c9d45f769cb9c2c0bbaf16541b93813a86ae00708c937c37f75b8719cdda771c8c10181eb87e6e1b227fc90e469f48d5ab9e8048002ffd224b596bd19e012
7
- data.tar.gz: b7da3ba38759a9ee69832753bb4a4c2e96c602673b547ad04e64309a6afbe3fb0708a21b7cc26f7f3663481bfdc91ff1bad31342251e6e9c7fdae0a2a868b356
6
+ metadata.gz: bfa2dc9c4f11a42e6b77c6504377cd115a3676715d06ec99481420edb8f0cf20a88764c840363c577f5169b635918b91029c648d2303a3af5e285b6f4f0ce701
7
+ data.tar.gz: 84c989522629c9942de5982d55473b42c5875c928ed7c217110bcd1ce6b81c6c1a1a7f9b1e1430cd90cb6119a3976c235571047f25f2cbab9763a035b5d44277
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.8.4
8
+ - Use nanosecond precision in elasticsearch_dynamic (#387)
9
+
7
10
  ### 2.8.3
8
11
  - Specify SSL/TLS version in out_elasticsearch_dynamic (#385)
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.8.3'
6
+ s.version = '2.8.4'
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}
@@ -160,7 +160,7 @@ module Fluent::Plugin
160
160
  time = Time.parse record[dynamic_conf['time_key']]
161
161
  record['@timestamp'] = record[dynamic_conf['time_key']] unless time_key_exclude_timestamp
162
162
  else
163
- record.merge!({"@timestamp" => Time.at(time).to_datetime.to_s})
163
+ record.merge!({"@timestamp" => Time.at(time).iso8601(@time_precision)})
164
164
  end
165
165
  end
166
166
 
@@ -647,8 +647,13 @@ class ElasticsearchOutput < Test::Unit::TestCase
647
647
  def test_content_type_header
648
648
  stub_request(:head, "http://localhost:9200/").
649
649
  to_return(:status => 200, :body => "", :headers => {})
650
- elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
651
- with(headers: { "Content-Type" => "application/json" })
650
+ if Elasticsearch::VERSION >= "6.0.2"
651
+ elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
652
+ with(headers: { "Content-Type" => "application/x-ndjson" })
653
+ else
654
+ elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
655
+ with(headers: { "Content-Type" => "application/json" })
656
+ end
652
657
  driver.run(default_tag: 'test') do
653
658
  driver.feed(sample_record)
654
659
  end
@@ -1390,13 +1395,9 @@ class ElasticsearchOutput < Test::Unit::TestCase
1390
1395
  driver.configure("logstash_format true\n")
1391
1396
  stub_elastic_ping
1392
1397
  stub_elastic
1393
- begin
1394
- time = Fluent::EventTime.new(Time.now.to_i, 000000000)
1395
- rescue
1396
- time = Fluent::Engine.now
1397
- end
1398
+ time = Fluent::EventTime.new(Time.now.to_i, 123456789)
1398
1399
  driver.run(default_tag: 'test') do
1399
- driver.feed(time.to_i, sample_record)
1400
+ driver.feed(time, sample_record)
1400
1401
  end
1401
1402
  assert(index_cmds[1].has_key? '@timestamp')
1402
1403
  assert_equal(index_cmds[1]['@timestamp'], Time.at(time).iso8601(9))
@@ -1407,13 +1408,9 @@ class ElasticsearchOutput < Test::Unit::TestCase
1407
1408
  time_precision 3\n")
1408
1409
  stub_elastic_ping
1409
1410
  stub_elastic
1410
- begin
1411
- time = Fluent::EventTime.new(Time.now.to_i, 000000000)
1412
- rescue
1413
- time = Fluent::Engine.now
1414
- end
1411
+ time = Fluent::EventTime.new(Time.now.to_i, 123456789)
1415
1412
  driver.run(default_tag: 'test') do
1416
- driver.feed(time.to_i, sample_record)
1413
+ driver.feed(time, sample_record)
1417
1414
  end
1418
1415
  assert(index_cmds[1].has_key? '@timestamp')
1419
1416
  assert_equal(index_cmds[1]['@timestamp'], Time.at(time).iso8601(3))
@@ -256,8 +256,13 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
256
256
  def test_content_type_header
257
257
  stub_request(:head, "http://localhost:9200/").
258
258
  to_return(:status => 200, :body => "", :headers => {})
259
- elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
260
- with(headers: { "Content-Type" => "application/json" })
259
+ if Elasticsearch::VERSION >= "6.0.2"
260
+ elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
261
+ with(headers: { "Content-Type" => "application/x-ndjson" })
262
+ else
263
+ elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
264
+ with(headers: { "Content-Type" => "application/json" })
265
+ end
261
266
  driver.run(default_tag: 'test') do
262
267
  driver.feed(sample_record)
263
268
  end
@@ -474,13 +479,25 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
474
479
  driver.configure("logstash_format true\n")
475
480
  stub_elastic_ping
476
481
  stub_elastic
477
- ts = DateTime.now
478
- time = Fluent::EventTime.from_time(ts.to_time)
482
+ time = Fluent::EventTime.new(Time.now.to_i, 123456789)
479
483
  driver.run(default_tag: 'test') do
480
484
  driver.feed(time, sample_record)
481
485
  end
482
486
  assert(index_cmds[1].has_key? '@timestamp')
483
- assert_equal(index_cmds[1]['@timestamp'], ts.iso8601)
487
+ assert_equal(index_cmds[1]['@timestamp'], Time.at(time).iso8601(9))
488
+ end
489
+
490
+ def test_uses_subsecond_precision_when_configured
491
+ driver.configure("logstash_format true
492
+ time_precision 3\n")
493
+ stub_elastic_ping
494
+ stub_elastic
495
+ time = Fluent::EventTime.new(Time.now.to_i, 123456789)
496
+ driver.run(default_tag: 'test') do
497
+ driver.feed(time, sample_record)
498
+ end
499
+ assert(index_cmds[1].has_key? '@timestamp')
500
+ assert_equal(index_cmds[1]['@timestamp'], Time.at(time).iso8601(3))
484
501
  end
485
502
 
486
503
  def test_uses_custom_timestamp_when_included_in_record
@@ -847,7 +864,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
847
864
  stub_request(:post, "http://localhost:9200/_bulk").with do |req|
848
865
  raise ZeroDivisionError, "any not host_unreachable_exceptions exception"
849
866
  end
850
-
867
+
851
868
  driver.configure("reconnect_on_error true\n")
852
869
 
853
870
  assert_raise(ZeroDivisionError) {
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.8.3
4
+ version: 2.8.4
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: 2018-03-22 00:00:00.000000000 Z
12
+ date: 2018-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd