fluent-plugin-elasticsearch 4.0.4 → 4.0.9

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: c4253b332821c59318a743dccc063cfe0bf5b6f5302727d0bf974280b41336ea
4
- data.tar.gz: 8731c0ba69bb200b1c397fc87ad0237c16ca8f5a825d37d16c0844664afd6292
3
+ metadata.gz: f76e6d69d85cace43250e57e272d26e492e4ae5d48856306687efc487279dd4d
4
+ data.tar.gz: c6f583de5857aba3c9a01bdde72e16c851d52cdc07b1151052155356954155ec
5
5
  SHA512:
6
- metadata.gz: 41eff72fc9b79075b3e3c2812c43fc34d4e789ca005bbe0d722e6d75ef9d01706841bba7214495a1d1bcdc3eeb5d86008c002e4aa4686508b22f1caafce731a3
7
- data.tar.gz: 3087f4fa5c6c008092366652ee388690bd012c6528ab01eb699fe352760a584500c83ea903d22b40693bf3d141bf7ed220f491cd64be3be08fa9a7ca2308f246
6
+ metadata.gz: 58003e22128dc44d615351ca0b36bd6bc2495d21b146f08713db6f8cfc77323192c38c841df446f30ec6d0edde89cced9c51a676f523e44d7488444ec9f2e737
7
+ data.tar.gz: 9b34567bea973a765fb2dbf699dadd26d80fd50b45b7b1179469d60425c67602e3d288f8da25305c089c20eb6daf236b900931ca0abd503d2665a5d6ab153c12
@@ -0,0 +1,26 @@
1
+ name: Testing on Ubuntu
2
+ on:
3
+ - push
4
+ - pull_request
5
+ jobs:
6
+ build:
7
+ runs-on: ${{ matrix.os }}
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: [ '2.4', '2.5', '2.6' ]
12
+ os:
13
+ - ubuntu-latest
14
+ name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - name: unit testing
21
+ env:
22
+ CI: true
23
+ run: |
24
+ gem install bundler rake
25
+ bundle install --jobs 4 --retry 3
26
+ bundle exec rake test
@@ -0,0 +1,26 @@
1
+ name: Testing on macOS
2
+ on:
3
+ - push
4
+ - pull_request
5
+ jobs:
6
+ build:
7
+ runs-on: ${{ matrix.os }}
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: [ '2.4', '2.5', '2.6' ]
12
+ os:
13
+ - macOS-latest
14
+ name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - name: unit testing
21
+ env:
22
+ CI: true
23
+ run: |
24
+ gem install bundler rake
25
+ bundle install --jobs 4 --retry 3
26
+ bundle exec rake test
@@ -0,0 +1,26 @@
1
+ name: Testing on Windows
2
+ on:
3
+ - push
4
+ - pull_request
5
+ jobs:
6
+ build:
7
+ runs-on: ${{ matrix.os }}
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: [ '2.4', '2.5', '2.6' ]
12
+ os:
13
+ - windows-latest
14
+ name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - name: unit testing
21
+ env:
22
+ CI: true
23
+ run: |
24
+ gem install bundler rake
25
+ bundle install --jobs 4 --retry 3
26
+ bundle exec rake test
@@ -1,17 +1,39 @@
1
1
  language: ruby
2
2
 
3
- matrix:
3
+ jobs:
4
4
  include:
5
5
  - rvm: 2.4.6
6
6
  gemfile: Gemfile
7
+ os: linux
8
+ arch: amd64
7
9
  - rvm: 2.5.5
8
10
  gemfile: Gemfile
11
+ os: linux
12
+ arch: amd64
9
13
  - rvm: 2.6.3
10
- gemfile: gemfiles/Gemfile.ilm
14
+ gemfile: gemfiles/Gemfile.without.ilm
15
+ os: linux
16
+ arch: amd64
17
+ - rvm: 2.6.3
18
+ gemfile: gemfiles/Gemfile.elasticsearch.v6
19
+ os: linux
20
+ arch: amd64
21
+ - rvm: 2.6.3
22
+ gemfile: Gemfile
23
+ os: linux
24
+ arch: amd64
25
+ - rvm: 2.6.3
26
+ gemfile: Gemfile
27
+ os: linux
28
+ arch: arm64
11
29
  - rvm: 2.6.3
12
30
  gemfile: Gemfile
31
+ os: osx
32
+ osx_image: xcode11.3
13
33
  - rvm: 2.7.0
14
34
  gemfile: Gemfile
35
+ os: linux
36
+ arch: amd64
15
37
 
16
38
  gemfile:
17
39
  - Gemfile
@@ -20,4 +42,3 @@ before_install:
20
42
  - gem update --system=2.7.8
21
43
 
22
44
  script: bundle exec rake test
23
- sudo: false
data/Gemfile CHANGED
@@ -4,6 +4,8 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'simplecov', require: false
7
- gem 'coveralls', require: false
7
+ gem 'coveralls', ">= 0.8.0", require: false
8
8
  gem 'strptime', require: false if RUBY_ENGINE == "ruby" && RUBY_VERSION =~ /^2/
9
9
  gem "irb" if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.6"
10
+ gem "elasticsearch-xpack"
11
+ gem "oj"
data/History.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 4.0.9
6
+ - Add possibility to configure multiple ILM policies (#753)
7
+ - Document required permissions (#757)
8
+
9
+ ### 4.0.8
10
+ - Handle compressable connection usable state (#743)
11
+ - Use newer tls protocol versions (#739)
12
+ - Add GitHub Actions file (#740)
13
+
14
+ ### 4.0.7
15
+ - Added http_backend_excon_nonblock config in out_elasticsearch (#733)
16
+
17
+ ### 4.0.6
18
+ - Add fallback mechanism for handling to detect es version (#730)
19
+ - Remove needless section (#728)
20
+ - Handle exception if index already exists (#727)
21
+ - Tweak test cases (#726)
22
+
23
+ ### 4.0.5
24
+ - add logstash_dateformat as placeholder (#718)
25
+ - Tweak travis.yml for suppressing validator warnings and add CI for Linux Arm64 architecture and macOS 10.14 (#724)
26
+ - Elasticsearch ruby v7.5 (#723)
27
+ - Add Oj serializer testcases for all job (#722)
28
+ - Update documentation for ILM (#721)
29
+
5
30
  ### 4.0.4
6
31
  - Provide clearing caches timer (#719)
7
32
 
data/README.md CHANGED
@@ -45,6 +45,7 @@ Current maintainers: @cosmo0920
45
45
  + [templates](#templates)
46
46
  + [max_retry_putting_template](#max_retry_putting_template)
47
47
  + [fail_on_putting_template_retry_exceed](#fail_on_putting_template_retry_exceed)
48
+ + [fail_on_detecting_es_version_retry_exceed](#fail_on_detecting_es_version_retry_exceed)
48
49
  + [max_retry_get_es_version](#max_retry_get_es_version)
49
50
  + [request_timeout](#request_timeout)
50
51
  + [reload_connections](#reload_connections)
@@ -65,6 +66,7 @@ Current maintainers: @cosmo0920
65
66
  + [content_type](#content_type)
66
67
  + [include_index_in_url](#include_index_in_url)
67
68
  + [http_backend](#http_backend)
69
+ + [http_backend_excon_nonblock](#http_backend_excon_nonblock)
68
70
  + [prefer_oj_serializer](#prefer_oj_serializer)
69
71
  + [compression_level](#compression_level)
70
72
  + [Client/host certificate options](#clienthost-certificate-options)
@@ -91,15 +93,16 @@ Current maintainers: @cosmo0920
91
93
  + [enable_ilm](#enable_ilm)
92
94
  + [ilm_policy_id](#ilm_policy_id)
93
95
  + [ilm_policy](#ilm_policy)
96
+ + [ilm_policies](#ilm_policies)
94
97
  + [ilm_policy_overwrite](#ilm_policy_overwrite)
95
98
  + [truncate_caches_interval](#truncate_caches_interval)
96
99
  * [Configuration - Elasticsearch Input](#configuration---elasticsearch-input)
100
+ * [Elasticsearch permissions](#elasticsearch-permissions)
97
101
  * [Troubleshooting](#troubleshooting)
98
102
  + [Cannot send events to elasticsearch](#cannot-send-events-to-elasticsearch)
99
103
  + [Cannot see detailed failure log](#cannot-see-detailed-failure-log)
100
104
  + [Cannot connect TLS enabled reverse Proxy](#cannot-connect-tls-enabled-reverse-proxy)
101
105
  + [Declined logs are resubmitted forever, why?](#declined-logs-are-resubmitted-forever-why)
102
- + [Suggested to increase flush_thread_count, why?](#suggested-to-increase-flush_thread_count-why)
103
106
  + [Suggested to install typhoeus gem, why?](#suggested-to-install-typhoeus-gem-why)
104
107
  + [Stopped to send events on k8s, why?](#stopped-to-send-events-on-k8s-why)
105
108
  + [Random 400 - Rejected by Elasticsearch is occured, why?](#random-400---rejected-by-elasticsearch-is-occured-why)
@@ -502,6 +505,23 @@ If you have multiple output plugin, you could use this property to do not fail o
502
505
  fail_on_putting_template_retry_exceed false # defaults to true
503
506
  ```
504
507
 
508
+ ### fail_on_detecting_es_version_retry_exceed
509
+
510
+ Indicates whether to fail when `max_retry_get_es_version` is exceeded.
511
+ If you want to use fallback mechanism for obtaining ELasticsearch version, you could use this property to do not fail on fluentd statup.
512
+
513
+ ```
514
+ fail_on_detecting_es_version_retry_exceed false
515
+ ```
516
+
517
+ And the following parameters should be working with:
518
+
519
+ ```
520
+ verify_es_version_at_startup true
521
+ max_retry_get_es_version 2 # greater than 0.
522
+ default_elasticsearch_version 7 # This version is used when occurring fallback.
523
+ ```
524
+
505
525
  ### max_retry_get_es_version
506
526
 
507
527
  You can specify times of retry obtaining Elasticsearch version.
@@ -799,6 +819,21 @@ Default value is `excon` which is default http_backend of elasticsearch plugin.
799
819
  http_backend typhoeus
800
820
  ```
801
821
 
822
+ ### http_backend_excon_nonblock
823
+
824
+ With `http_backend_excon_nonblock false`, elasticsearch plugin use excon with nonblock=false.
825
+ If you use elasticsearch plugin with jRuby for https, you may need to consider to set `false` to avoid follwoing problems.
826
+ - https://github.com/geemus/excon/issues/106
827
+ - https://github.com/jruby/jruby-ossl/issues/19
828
+
829
+ But for all other case, it strongly reccomend to set `true` to avoid process hangin problem reported in https://github.com/uken/fluent-plugin-elasticsearch/issues/732
830
+
831
+ Default value is `true`.
832
+
833
+ ```
834
+ http_backend_excon_nonblock false
835
+ ```
836
+
802
837
  ### compression_level
803
838
  You can add gzip compression of output data. In this case `default_compression`, `best_compression` or `best speed` option should be chosen.
804
839
  By default there is no compression, default value for this option is `no_compression`
@@ -848,7 +883,11 @@ ssl_min_version TLSv1_2
848
883
 
849
884
  Elasticsearch plugin will use TLSv1.2 as minimum ssl version and TLSv1.3 as maximum ssl version on transportation with TLS. Note that when they are used in Elastissearch plugin configuration, *`ssl_version` is not used* to set up TLS version.
850
885
 
851
- If they are *not* specified in the Elasticsearch plugin configuration, the value of `ssl_version` will be *used in `ssl_max_version` and `ssl_min_version`*.
886
+ If they are *not* specified in the Elasticsearch plugin configuration, `ssl_max_version` and `ssl_min_version` is set up with:
887
+
888
+ In Elasticsearch plugin v4.0.8 or later with Ruby 2.5 or later environment, `ssl_max_version` should be `TLSv1_3` and `ssl_min_version` should be `TLSv1_2`.
889
+
890
+ From Elasticsearch plugin v4.0.4 to v4.0.7 with Ruby 2.5 or later environment, the value of `ssl_version` will be *used in `ssl_max_version` and `ssl_min_version`*.
852
891
 
853
892
 
854
893
  ### Proxy Support
@@ -1176,6 +1215,14 @@ Default value is `{}`.
1176
1215
 
1177
1216
  **NOTE:** This parameter requests to install elasticsearch-xpack gem.
1178
1217
 
1218
+ ## ilm_policies
1219
+
1220
+ A hash in the format `{"ilm_policy_id1":{ <ILM policy 1 hash> }, "ilm_policy_id2": { <ILM policy 2 hash> }}`.
1221
+
1222
+ Default value is `{}`.
1223
+
1224
+ **NOTE:** This parameter requests to install elasticsearch-xpack gem.
1225
+
1179
1226
  ## ilm_policy_overwrite
1180
1227
 
1181
1228
  Specify whether overwriting ilm policy or not.
@@ -1196,6 +1243,32 @@ Default value is `nil`.
1196
1243
 
1197
1244
  See [Elasticsearch Input plugin document](README.ElasticsearchInput.md)
1198
1245
 
1246
+ ## Elasticsearch permissions
1247
+
1248
+ If the target Elasticsearch requires authentication, a user holding the necessary permissions needs to be provided.
1249
+
1250
+ The set of required permissions are the following:
1251
+
1252
+ ```json
1253
+ "cluster": ["manage_index_templates", "monitor", "manage_ilm"],
1254
+ "indices": [
1255
+ {
1256
+ "names": [ "*" ],
1257
+ "privileges": ["write","create","delete","create_index","manage","manage_ilm"]
1258
+ }
1259
+ ]
1260
+ ```
1261
+
1262
+ These permissions can be narrowed down by:
1263
+
1264
+ - Setting a more specific pattern for indices under the `names` field
1265
+ - Removing the `manage_index_templates` cluster permission when not using the feature within your plugin configuration
1266
+ - Removing the `manage_ilm` cluster permission and the `manage` and `manage_ilm` indices privileges when not using ilm
1267
+ features in the plugin configuration
1268
+
1269
+ The list of privileges along with their description can be found in
1270
+ [security privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-privileges.html).
1271
+
1199
1272
  ## Troubleshooting
1200
1273
 
1201
1274
  ### Cannot send events to Elasticsearch
@@ -1445,30 +1518,6 @@ The following configuration uses label:
1445
1518
  </label>
1446
1519
  ```
1447
1520
 
1448
- ### Suggested to increase flush_thread_count, why?
1449
-
1450
- fluent-plugin-elasticsearch default behavior has a possibility to cause events traffic jam.
1451
- When users use `flush_thread_count` = 1, ES plugin retries to send events if connection errors are disappeared.
1452
-
1453
- To prevent the following warning and sending events blocking, you must specify `flush_thread_count` >= 2:
1454
-
1455
- ```log
1456
- 2018-12-24 14:32:06 +0900 [warn]: #0 To prevent events traffic jam, you should specify 2 or more 'flush_thread_count'.
1457
- ```
1458
-
1459
- ```aconf
1460
- <match out.elasticsearch.**>
1461
- @type elasticsearch
1462
- host localhost
1463
- port 9200
1464
- # ...
1465
- <buffer tag>
1466
- @type memory # or file
1467
- flush_thread_count 4
1468
- </buffer>
1469
- </match>
1470
- ```
1471
-
1472
1521
  ### Suggested to install typhoeus gem, why?
1473
1522
 
1474
1523
  fluent-plugin-elasticsearch doesn't depend on typhoeus gem by default.
@@ -1639,17 +1688,31 @@ Main ILM feature parameters are:
1639
1688
  * `ilm_policy_id`
1640
1689
  * `ilm_policy`
1641
1690
 
1691
+ * Advanced usage parameters
1692
+ * `application_name`
1693
+ * `index_separator`
1694
+
1642
1695
  They are not all mandatory parameters but they are used for ILM feature in effect.
1643
1696
 
1644
1697
  ILM target index alias is created with `index_name` or an index which is calculated from `logstash_prefix`.
1645
1698
 
1646
1699
  From Elasticsearch plugin v4.0.0, ILM target index will be calculated from `index_name` (normal mode) or `logstash_prefix` (using with `logstash_format`as true).
1647
1700
 
1648
- When using `deflectoe_alias` parameter, Elasticsearch plugin will create ILM target indices alias with `deflector_alias` instead of `index_name` or an index which is calculated from `logstash_prefix`. This behavior should be kept due to backward ILM feature compatibility.
1701
+ When using `deflector_alias` parameter, Elasticsearch plugin will create ILM target indices alias with `deflector_alias` instead of `index_name` or an index which is calculated from `logstash_prefix`. This behavior should be kept due to backward ILM feature compatibility.
1649
1702
 
1650
1703
  And also, ILM feature users should specify their Elasticsearch template for ILM enabled indices.
1651
1704
  Because ILM settings are injected into their Elasticsearch templates.
1652
1705
 
1706
+ `application_name` and `index_separator` also affect alias index names.
1707
+
1708
+ But this parameter is prepared for advanced usage.
1709
+
1710
+ It usually should be used with default value which is `default`.
1711
+
1712
+ Then, ILM parameters are used in alias index like as:
1713
+
1714
+ `<index_name/logstash_prefix><index_separator><application_name>-000001`.
1715
+
1653
1716
  #### Example ILM settings
1654
1717
 
1655
1718
  ```aconf
@@ -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 = '4.0.4'
6
+ s.version = '4.0.9'
7
7
  s.authors = ['diogo', 'pitr', 'Hiroshi Hatake']
8
8
  s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com', 'cosmo0920.wp@gmail.com']
9
9
  s.description = %q{Elasticsearch output plugin for Fluent event collector}
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-elasticsearch.gemspec
4
+ gemspec :path => "../"
5
+
6
+ gem 'simplecov', require: false
7
+ gem 'coveralls', ">= 0.8.0", require: false
8
+ gem 'strptime', require: false if RUBY_ENGINE == "ruby" && RUBY_VERSION =~ /^2/
9
+ gem "irb" if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.6"
10
+ gem "elasticsearch", "~> 6.8.1"
11
+ gem "elasticsearch-xpack"
12
+ gem "oj"
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec :path => "../"
5
5
 
6
6
  gem 'simplecov', require: false
7
- gem 'coveralls', require: false
7
+ gem 'coveralls', ">= 0.8.0", require: false
8
8
  gem 'strptime', require: false if RUBY_ENGINE == "ruby" && RUBY_VERSION =~ /^2/
9
9
  gem "irb" if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.6"
10
- gem "elasticsearch-xpack"
10
+ gem "oj"
@@ -58,7 +58,7 @@ module Fluent::ElasticsearchIndexTemplate
58
58
  def indexcreation(index_name, host = nil)
59
59
  client(host).indices.create(:index => index_name)
60
60
  rescue Elasticsearch::Transport::Transport::Error => e
61
- if e.message =~ /"already exists"/
61
+ if e.message =~ /"already exists"/ || e.message =~ /resource_already_exists_exception/
62
62
  log.debug("Index #{index_name} already exists")
63
63
  else
64
64
  log.error("Error while index creation - #{index_name}: #{e.inspect}")
@@ -10,7 +10,7 @@ module Fluent::Plugin
10
10
  [:SSLv23, :TLSv1, :TLSv1_1, :TLSv1_2].freeze
11
11
  end
12
12
 
13
- DEFAULT_VERSION = :TLSv1
13
+ DEFAULT_VERSION = :TLSv1_2
14
14
  METHODS_MAP = begin
15
15
  # When openssl supports OpenSSL::SSL::TLSXXX constants representations, we use them.
16
16
  map = {
@@ -48,8 +48,8 @@ module Fluent::Plugin
48
48
  if USE_TLS_MINMAX_VERSION
49
49
  case
50
50
  when ssl_min_version.nil? && ssl_max_version.nil?
51
- ssl_min_version = METHODS_MAP[ssl_version]
52
- ssl_max_version = METHODS_MAP[ssl_version]
51
+ ssl_min_version = METHODS_MAP[:TLSv1_2]
52
+ ssl_max_version = METHODS_MAP[:TLSv1_3]
53
53
  when ssl_min_version && ssl_max_version.nil?
54
54
  raise Fluent::ConfigError, "When you set 'ssl_min_version', must set 'ssl_max_version' together."
55
55
  when ssl_min_version.nil? && ssl_max_version