fluent-plugin-elasticsearch 2.5.0 → 2.6.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
  SHA256:
3
- metadata.gz: 9d722819bc4644442e84bd13acbd6d1fe7845d6fc01119d3a4c8475321d1195d
4
- data.tar.gz: a4956fa749f46343aa3609cc319cff6c5e28797b50384ece1284566ee773045f
3
+ metadata.gz: 3427ecaceac8a69b1fc2bf12bef3f54e10fe5d88c4de2ed314e4f5eaf370b213
4
+ data.tar.gz: 284c78599965eda36d1c0927e9f291db9eddf08d07d586f8e333e530c7ca3cdf
5
5
  SHA512:
6
- metadata.gz: 55cb3916853e0a3ad24bc450aecd577f13cbcb20f8d9a4b446ffa4beb7dce6df5fcd8ca4583846f53921b69404421f3bd8a714dedaac596745600a4b7084744e
7
- data.tar.gz: e46f86ba7109bce5f51628f3209497c3a5ec706641f25cb267391a173384acc26c626bce2f1280d1d72f1cebb7e9188f76afa6baf1246e2b01f6f5e3c913b3f5
6
+ metadata.gz: a7cec3fc89d1a48543052096072e34495992c950deaa56b982be29d89062533e90844b3edd9bf7eef46c74e787eda51395751041384c948ff0bff5dbfa15c598
7
+ data.tar.gz: bf4140896391b928c970bcb3cf877fb0380326a182c9b0980793b9ab0522be8e5fd789247e66d4313bace64e430d8f8719a40b42a40bad958b9d339add490ce7
@@ -3,7 +3,9 @@ language: ruby
3
3
  rvm:
4
4
  - 2.1
5
5
  - 2.2
6
- - 2.3.1
6
+ - 2.3.6
7
+ - 2.4.3
8
+ - 2.5.0
7
9
 
8
10
  gemfile:
9
11
  - Gemfile
data/History.md CHANGED
@@ -4,8 +4,11 @@
4
4
  - Log ES response errors (#230)
5
5
  - Use latest elasticsearch-ruby (#240)
6
6
 
7
+ ### 2.6.0
8
+ - Handle high precision time format when using custom time_key (#360)
9
+
7
10
  ### 2.5.0
8
- - Using nested record in `id_key`, `parent_key`, and `routing_key` (#351
11
+ - Using nested record in `id_key`, `parent_key`, and `routing_key` (#351)
9
12
  - Fix inverted case of a proper noun "Elasticsearch" (#349)
10
13
 
11
14
  ### 2.4.1
data/README.md CHANGED
@@ -73,6 +73,8 @@ Current maintainers: @cosmo0920
73
73
 
74
74
  NOTE: For v0.12 version, you should use 1.x.y version. Please send patch into v0.12 branch if you encountered 1.x version's bug.
75
75
 
76
+ NOTE: This documentation is for fluent-plugin-elasticsearch 2.x or later. For 1.x documentation, please see [v0.12 branch](https://github.com/uken/fluent-plugin-elasticsearch/tree/v0.12).
77
+
76
78
  ## Installation
77
79
 
78
80
  ```sh
@@ -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.5.0'
6
+ s.version = '2.6.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}
@@ -376,7 +376,7 @@ module Fluent::Plugin
376
376
  elsif record.has_key?(@time_key)
377
377
  rts = record[@time_key]
378
378
  dt = parse_time(rts, time, tag)
379
- record[TIMESTAMP_FIELD] = rts unless @time_key_exclude_timestamp
379
+ record[TIMESTAMP_FIELD] = dt.iso8601(@time_precision) unless @time_key_exclude_timestamp
380
380
  else
381
381
  dt = Time.at(time).to_datetime
382
382
  record[TIMESTAMP_FIELD] = dt.iso8601(@time_precision)
@@ -706,7 +706,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
706
706
  ))
707
707
  stub_elastic_ping
708
708
  stub_elastic
709
- time = Time.parse Date.today.to_s
709
+ time = Time.parse Date.today.iso8601
710
710
  driver.run(default_tag: 'test') do
711
711
  driver.feed(time.to_i, sample_record)
712
712
  end
@@ -722,7 +722,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
722
722
  Fluent::Config::Element.new('buffer', 'tag,pipeline_id', {}, [])
723
723
  ]
724
724
  ))
725
- time = Time.parse Date.today.to_s
725
+ time = Time.parse Date.today.iso8601
726
726
  pipeline_id = "mypipeline"
727
727
  logstash_index = "myindex.#{pipeline_id}"
728
728
  stub_elastic_ping
@@ -761,7 +761,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
761
761
  def test_writes_to_target_index_key_logstash
762
762
  driver.configure("target_index_key @target_index
763
763
  logstash_format true")
764
- time = Time.parse Date.today.to_s
764
+ time = Time.parse Date.today.iso8601
765
765
  stub_elastic_ping
766
766
  stub_elastic
767
767
  driver.run(default_tag: 'test') do
@@ -773,7 +773,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
773
773
  def test_writes_to_target_index_key_logstash_uppercase
774
774
  driver.configure("target_index_key @target_index
775
775
  logstash_format true")
776
- time = Time.parse Date.today.to_s
776
+ time = Time.parse Date.today.iso8601
777
777
  stub_elastic_ping
778
778
  stub_elastic
779
779
  driver.run(default_tag: 'test') do
@@ -808,7 +808,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
808
808
  def test_writes_to_target_index_key_fallack_logstash
809
809
  driver.configure("target_index_key @target_index\n
810
810
  logstash_format true")
811
- time = Time.parse Date.today.to_s
811
+ time = Time.parse Date.today.iso8601
812
812
  logstash_index = "logstash-#{time.getutc.strftime("%Y.%m.%d")}"
813
813
  stub_elastic_ping
814
814
  stub_elastic
@@ -1040,7 +1040,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1040
1040
  def test_writes_to_logstash_index_with_specified_prefix
1041
1041
  driver.configure("logstash_format true
1042
1042
  logstash_prefix myprefix")
1043
- time = Time.parse Date.today.to_s
1043
+ time = Time.parse Date.today.iso8601
1044
1044
  logstash_index = "myprefix-#{time.getutc.strftime("%Y.%m.%d")}"
1045
1045
  stub_elastic_ping
1046
1046
  stub_elastic
@@ -1055,7 +1055,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1055
1055
  driver.configure("logstash_format true
1056
1056
  logstash_prefix_separator #{separator}
1057
1057
  logstash_prefix myprefix")
1058
- time = Time.parse Date.today.to_s
1058
+ time = Time.parse Date.today.iso8601
1059
1059
  logstash_index = "myprefix#{separator}#{time.getutc.strftime("%Y.%m.%d")}"
1060
1060
  stub_elastic_ping
1061
1061
  stub_elastic
@@ -1069,7 +1069,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1069
1069
  def test_writes_to_logstash_index_with_specified_prefix_and_tag_placeholder
1070
1070
  driver.configure("logstash_format true
1071
1071
  logstash_prefix myprefix-${tag}")
1072
- time = Time.parse Date.today.to_s
1072
+ time = Time.parse Date.today.iso8601
1073
1073
  logstash_index = "myprefix-test-#{time.getutc.strftime("%Y.%m.%d")}"
1074
1074
  stub_elastic_ping
1075
1075
  stub_elastic
@@ -1092,7 +1092,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1092
1092
  }, [])
1093
1093
  ]
1094
1094
  ))
1095
- time = Time.parse Date.today.to_s
1095
+ time = Time.parse Date.today.iso8601
1096
1096
  logstash_index = "myprefix-#{time.getutc.strftime("%H")}-#{time.getutc.strftime("%Y.%m.%d")}"
1097
1097
  stub_elastic_ping
1098
1098
  stub_elastic
@@ -1112,7 +1112,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1112
1112
  Fluent::Config::Element.new('buffer', 'tag,pipeline_id', {}, [])
1113
1113
  ]
1114
1114
  ))
1115
- time = Time.parse Date.today.to_s
1115
+ time = Time.parse Date.today.iso8601
1116
1116
  pipeline_id = "mypipeline"
1117
1117
  logstash_index = "myprefix-#{pipeline_id}-#{time.getutc.strftime("%Y.%m.%d")}"
1118
1118
  stub_elastic_ping
@@ -1127,7 +1127,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1127
1127
  def test_writes_to_logstash_index_with_specified_prefix_uppercase
1128
1128
  driver.configure("logstash_format true
1129
1129
  logstash_prefix MyPrefix")
1130
- time = Time.parse Date.today.to_s
1130
+ time = Time.parse Date.today.iso8601
1131
1131
  logstash_index = "myprefix-#{time.getutc.strftime("%Y.%m.%d")}"
1132
1132
  stub_elastic_ping
1133
1133
  stub_elastic
@@ -1142,7 +1142,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1142
1142
  def test_writes_to_logstash_index_with_specified_dateformat
1143
1143
  driver.configure("logstash_format true
1144
1144
  logstash_dateformat %Y.%m")
1145
- time = Time.parse Date.today.to_s
1145
+ time = Time.parse Date.today.iso8601
1146
1146
  logstash_index = "logstash-#{time.getutc.strftime("%Y.%m")}"
1147
1147
  stub_elastic_ping
1148
1148
  stub_elastic
@@ -1156,7 +1156,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1156
1156
  driver.configure("logstash_format true
1157
1157
  logstash_prefix myprefix
1158
1158
  logstash_dateformat %Y.%m")
1159
- time = Time.parse Date.today.to_s
1159
+ time = Time.parse Date.today.iso8601
1160
1160
  logstash_index = "myprefix-#{time.getutc.strftime("%Y.%m")}"
1161
1161
  stub_elastic_ping
1162
1162
  stub_elastic
@@ -1202,10 +1202,8 @@ class ElasticsearchOutput < Test::Unit::TestCase
1202
1202
  driver.run(default_tag: 'test') do
1203
1203
  driver.feed(time, sample_record)
1204
1204
  end
1205
- tf = "%Y-%m-%dT%H:%M:%S%:z"
1206
- timef = Fluent::TimeFormatter.new(tf, true, ENV["TZ"])
1207
1205
  assert(index_cmds[1].has_key? '@timestamp')
1208
- assert_equal(timef.format(Time.parse(index_cmds[1]['@timestamp'])).to_s, ts.to_s)
1206
+ assert_equal(index_cmds[1]['@timestamp'], ts.iso8601(9))
1209
1207
  end
1210
1208
 
1211
1209
  def test_adds_timestamp_when_include_timestamp
@@ -1217,17 +1215,15 @@ class ElasticsearchOutput < Test::Unit::TestCase
1217
1215
  driver.run(default_tag: 'test') do
1218
1216
  driver.feed(time, sample_record)
1219
1217
  end
1220
- tf = "%Y-%m-%dT%H:%M:%S%:z"
1221
- timef = Fluent::TimeFormatter.new(tf, true, ENV["TZ"])
1222
1218
  assert(index_cmds[1].has_key? '@timestamp')
1223
- assert_equal(timef.format(Time.parse(index_cmds[1]['@timestamp'])).to_s, ts.to_s)
1219
+ assert_equal(index_cmds[1]['@timestamp'], ts.iso8601(9))
1224
1220
  end
1225
1221
 
1226
1222
  def test_uses_custom_timestamp_when_included_in_record
1227
1223
  driver.configure("logstash_format true\n")
1228
1224
  stub_elastic_ping
1229
1225
  stub_elastic
1230
- ts = DateTime.new(2001,2,3).to_s
1226
+ ts = DateTime.new(2001,2,3).iso8601
1231
1227
  driver.run(default_tag: 'test') do
1232
1228
  driver.feed(sample_record.merge!('@timestamp' => ts))
1233
1229
  end
@@ -1239,7 +1235,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1239
1235
  driver.configure("include_timestamp true\n")
1240
1236
  stub_elastic_ping
1241
1237
  stub_elastic
1242
- ts = DateTime.new(2001,2,3).to_s
1238
+ ts = DateTime.new(2001,2,3).iso8601
1243
1239
  driver.run(default_tag: 'test') do
1244
1240
  driver.feed(sample_record.merge!('@timestamp' => ts))
1245
1241
  end
@@ -1252,7 +1248,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1252
1248
  time_key vtm\n")
1253
1249
  stub_elastic_ping
1254
1250
  stub_elastic
1255
- ts = DateTime.new(2001,2,3).to_s
1251
+ ts = DateTime.new(2001,2,3).iso8601(9)
1256
1252
  driver.run(default_tag: 'test') do
1257
1253
  driver.feed(sample_record.merge!('vtm' => ts))
1258
1254
  end
@@ -1271,7 +1267,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1271
1267
  driver.feed(sample_record.merge!('vtm' => ts))
1272
1268
  end
1273
1269
  assert(index_cmds[1].has_key? '@timestamp')
1274
- assert_equal(index_cmds[1]['@timestamp'], ts)
1270
+ assert_equal(index_cmds[1]['@timestamp'], DateTime.parse(ts).iso8601(9))
1275
1271
  assert_equal("logstash-2001.02.03", index_cmds[0]['index']['_index'])
1276
1272
  end
1277
1273
 
@@ -1287,7 +1283,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1287
1283
  driver.feed(sample_record.merge!('vtm' => ts))
1288
1284
  end
1289
1285
  assert(index_cmds[1].has_key? '@timestamp')
1290
- assert_equal(index_cmds[1]['@timestamp'], ts)
1286
+ assert_equal(index_cmds[1]['@timestamp'], DateTime.parse(ts).iso8601(9))
1291
1287
  assert_equal("test", index_cmds[0]['index']['_index'])
1292
1288
  end
1293
1289
 
@@ -1297,7 +1293,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
1297
1293
  time_key_exclude_timestamp true\n")
1298
1294
  stub_elastic_ping
1299
1295
  stub_elastic
1300
- ts = DateTime.new(2001,2,3).to_s
1296
+ ts = DateTime.new(2001,2,3).iso8601
1301
1297
  driver.run(default_tag: 'test') do
1302
1298
  driver.feed(sample_record.merge!('vtm' => ts))
1303
1299
  end
@@ -369,7 +369,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
369
369
 
370
370
  def test_writes_to_logstash_index
371
371
  driver.configure("logstash_format true\n")
372
- time = Time.parse Date.today.to_s
372
+ time = Time.parse Date.today.iso8601
373
373
  logstash_index = "logstash-#{time.getutc.strftime("%Y.%m.%d")}"
374
374
  stub_elastic_ping
375
375
  stub_elastic
@@ -382,7 +382,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
382
382
  def test_writes_to_logstash_utc_index
383
383
  driver.configure("logstash_format true
384
384
  utc_index false")
385
- time = Time.parse Date.today.to_s
385
+ time = Time.parse Date.today.iso8601
386
386
  utc_index = "logstash-#{time.strftime("%Y.%m.%d")}"
387
387
  stub_elastic_ping
388
388
  stub_elastic
@@ -395,7 +395,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
395
395
  def test_writes_to_logstash_index_with_specified_prefix
396
396
  driver.configure("logstash_format true
397
397
  logstash_prefix myprefix")
398
- time = Time.parse Date.today.to_s
398
+ time = Time.parse Date.today.iso8601
399
399
  logstash_index = "myprefix-#{time.getutc.strftime("%Y.%m.%d")}"
400
400
  stub_elastic_ping
401
401
  stub_elastic
@@ -408,7 +408,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
408
408
  def test_writes_to_logstash_index_with_specified_prefix_uppercase
409
409
  driver.configure("logstash_format true
410
410
  logstash_prefix MyPrefix")
411
- time = Time.parse Date.today.to_s
411
+ time = Time.parse Date.today.iso8601
412
412
  logstash_index = "myprefix-#{time.getutc.strftime("%Y.%m.%d")}"
413
413
  stub_elastic_ping
414
414
  stub_elastic
@@ -421,7 +421,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
421
421
  def test_writes_to_logstash_index_with_specified_dateformat
422
422
  driver.configure("logstash_format true
423
423
  logstash_dateformat %Y.%m")
424
- time = Time.parse Date.today.to_s
424
+ time = Time.parse Date.today.iso8601
425
425
  logstash_index = "logstash-#{time.getutc.strftime("%Y.%m")}"
426
426
  stub_elastic_ping
427
427
  stub_elastic
@@ -435,7 +435,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
435
435
  driver.configure("logstash_format true
436
436
  logstash_prefix myprefix
437
437
  logstash_dateformat %Y.%m")
438
- time = Time.parse Date.today.to_s
438
+ time = Time.parse Date.today.iso8601
439
439
  logstash_index = "myprefix-#{time.getutc.strftime("%Y.%m")}"
440
440
  stub_elastic_ping
441
441
  stub_elastic
@@ -464,14 +464,14 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
464
464
  driver.feed(time, sample_record)
465
465
  end
466
466
  assert(index_cmds[1].has_key? '@timestamp')
467
- assert_equal(index_cmds[1]['@timestamp'], ts.to_s)
467
+ assert_equal(index_cmds[1]['@timestamp'], ts.iso8601)
468
468
  end
469
469
 
470
470
  def test_uses_custom_timestamp_when_included_in_record
471
471
  driver.configure("include_timestamp true\n")
472
472
  stub_elastic_ping
473
473
  stub_elastic
474
- ts = DateTime.new(2001,2,3).to_s
474
+ ts = DateTime.new(2001,2,3).iso8601
475
475
  driver.run(default_tag: 'test') do
476
476
  driver.feed(sample_record.merge!('@timestamp' => ts))
477
477
  end
@@ -483,7 +483,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
483
483
  driver.configure("logstash_format true\n")
484
484
  stub_elastic_ping
485
485
  stub_elastic
486
- ts = DateTime.new(2001,2,3).to_s
486
+ ts = DateTime.new(2001,2,3).iso8601
487
487
  driver.run(default_tag: 'test') do
488
488
  driver.feed(sample_record.merge!('@timestamp' => ts))
489
489
  end
@@ -496,7 +496,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
496
496
  time_key vtm\n")
497
497
  stub_elastic_ping
498
498
  stub_elastic
499
- ts = DateTime.new(2001,2,3).to_s
499
+ ts = DateTime.new(2001,2,3).iso8601
500
500
  driver.run(default_tag: 'test') do
501
501
  driver.feed(sample_record.merge!('vtm' => ts))
502
502
  end
@@ -509,7 +509,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
509
509
  time_key vtm\n")
510
510
  stub_elastic_ping
511
511
  stub_elastic
512
- ts = DateTime.new(2001,2,3).to_s
512
+ ts = DateTime.new(2001,2,3).iso8601
513
513
  driver.run(default_tag: 'test') do
514
514
  driver.feed(sample_record.merge!('vtm' => ts))
515
515
  end
@@ -523,7 +523,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
523
523
  time_key vtm\n")
524
524
  stub_elastic_ping
525
525
  stub_elastic
526
- ts = DateTime.new(2001,2,3).to_s
526
+ ts = DateTime.new(2001,2,3).iso8601
527
527
  driver.run(default_tag: 'test') do
528
528
  driver.feed(sample_record.merge!('vtm' => ts))
529
529
  end
@@ -538,7 +538,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
538
538
  time_key_exclude_timestamp true\n")
539
539
  stub_elastic_ping
540
540
  stub_elastic
541
- ts = DateTime.new(2001,2,3).to_s
541
+ ts = DateTime.new(2001,2,3).iso8601
542
542
  driver.run(default_tag: 'test') do
543
543
  driver.feed(sample_record.merge!('vtm' => ts))
544
544
  end
@@ -551,7 +551,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
551
551
  time_key_exclude_timestamp true\n")
552
552
  stub_elastic_ping
553
553
  stub_elastic
554
- ts = DateTime.new(2001,2,3).to_s
554
+ ts = DateTime.new(2001,2,3).iso8601
555
555
  driver.run(default_tag: 'test') do
556
556
  driver.feed(sample_record.merge!('vtm' => ts))
557
557
  end
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.5.0
4
+ version: 2.6.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: 2018-01-25 00:00:00.000000000 Z
12
+ date: 2018-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd