fluent-plugin-elasticsearch 2.12.0 → 2.12.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: daf714ffb7c731c2d2792efd8930165c2ca8baa3c387eae815f41d2ccfd89ead
4
- data.tar.gz: df13ef1152b10bb2d63e7a870ab9afcbed6f040e6aee2a671f376690d0e616bb
3
+ metadata.gz: 9d653e88c7896e738bd345f3f5732c1f41f251b9372bf62fb0da758769b891b5
4
+ data.tar.gz: 574a4d8d57c0f98a667f853efa0214c6e952b8b30b30197f000037ca7f3044c4
5
5
  SHA512:
6
- metadata.gz: b33818935a059b0e150bb5dcc0cbc1179a3b7179d4fd0b29c964d8238efcbaa68cc59b3232f3f326ba855914b2d54d1fd9bdf0eb107a75108a1c38dae8c305e0
7
- data.tar.gz: 4d8d1cd2a3700e657c763caf5544344e6bfad1c185879539f48b52a65b84e5ba4dbc8bd524a1934e7d29348a20d7763a4c156519f71bb49c296b3192b2185069
6
+ metadata.gz: 249b1fe3782ec8ce4401c671b24c85d239608c214574b3b692d62e7f201c68d4b4f85d28779e6259c25a5e05b212961eb8ef7c900d541b2c28ceaae3a62d5ead
7
+ data.tar.gz: 2d1841c7f6d6f71a63daabb78f3b75266be7543e6f6cf03e686beebcaf7aee4a9678f6885aface2fc1c12c6d695ea2185c6f689faef5e01c981793a5ee433cd3
data/History.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 2.12.1
6
+ - Make configurable unrecoverable types (#501)
7
+ - Add FAQ for TLS enabled nginx proxy TLS version incompatibility trouble (#496)
8
+ - Add FAQs (#492)
9
+ - Remove issuestats.com badges (#489)
10
+
5
11
  ### 2.12.0
6
12
  - Decoupling the custom template and rollover index creation #485 (#486)
7
13
 
@@ -23,3 +23,4 @@ Provide example config and message
23
23
  * paste boot log of fluentd or td-agent
24
24
  * paste result of ``fluent-gem list``, ``td-agent-gem list`` or your Gemfile.lock
25
25
  * ES version (optional)
26
+ * Bear Metal or Within Docker or Kubernetes or others? (optional)
data/README.md CHANGED
@@ -4,8 +4,6 @@
4
4
  [![Build Status](https://travis-ci.org/uken/fluent-plugin-elasticsearch.png?branch=master)](https://travis-ci.org/uken/fluent-plugin-elasticsearch)
5
5
  [![Coverage Status](https://coveralls.io/repos/uken/fluent-plugin-elasticsearch/badge.png)](https://coveralls.io/r/uken/fluent-plugin-elasticsearch)
6
6
  [![Code Climate](https://codeclimate.com/github/uken/fluent-plugin-elasticsearch.png)](https://codeclimate.com/github/uken/fluent-plugin-elasticsearch)
7
- [![Issue Stats](http://issuestats.com/github/uken/fluent-plugin-elasticsearch/badge/pr)](http://issuestats.com/github/uken/fluent-plugin-elasticsearch)
8
- [![Issue Stats](http://issuestats.com/github/uken/fluent-plugin-elasticsearch/badge/issue)](http://issuestats.com/github/uken/fluent-plugin-elasticsearch)
9
7
 
10
8
  Send your logs to Elasticsearch (and search them with Kibana maybe?)
11
9
 
@@ -71,10 +69,15 @@ Current maintainers: @cosmo0920
71
69
  + [sniffer_class_name](#sniffer_class_name)
72
70
  + [reload_after](#reload_after)
73
71
  + [validate_client_version](#validate-client-version)
72
+ + [unrecoverable_error_types](#unrecoverable-error-types)
74
73
  + [Not seeing a config you need?](#not-seeing-a-config-you-need)
75
74
  + [Dynamic configuration](#dynamic-configuration)
76
75
  + [Placeholders](#placeholders)
77
76
  + [Multi workers](#multi-workers)
77
+ * [Troubleshooting](#troubleshooting)
78
+ + [Cannot send events to elasticsearch](#cannot-send-events-to-elasticsearch)
79
+ + [Cannot see detailed failure log](#cannot-see-detailed-failure-log)
80
+ + [Cannot connect TLS enabled reverse Proxy](#cannot-connect-tls-enabled-reverse-proxy)
78
81
  * [Contact](#contact)
79
82
  * [Contributing](#contributing)
80
83
  * [Running tests](#running-tests)
@@ -820,6 +823,27 @@ When you use mismatched Elasticsearch server and client libraries, fluent-plugin
820
823
  validate_client_version true
821
824
  ```
822
825
 
826
+ ### Unrecoverable Error Types
827
+
828
+ Default `unrecoverable_error_types` parameter is set up strictly.
829
+ Because `es_rejected_execution_exception` is caused by exceeding Elasticsearch's thread pool capacity.
830
+ Advanced users can increase its capacity, but normal users should follow default behavior.
831
+
832
+ If you want to increase it and forcibly retrying bulk request, please consider to change `unrecoverable_error_types` parameter from default value.
833
+
834
+ Change default value of `thread_pool.bulk.queue_size` in elasticsearch.yml:
835
+ e.g.)
836
+
837
+ ```yaml
838
+ thread_pool.bulk.queue_size: 1000
839
+ ```
840
+
841
+ Then, remove `es_rejected_execution_exception` from `unrecoverable_error_types` parameter:
842
+
843
+ ```
844
+ unrecoverable_error_types ["out_of_memory_error"]
845
+ ```
846
+
823
847
  ### Not seeing a config you need?
824
848
 
825
849
  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.
@@ -922,6 +946,153 @@ Since Fluentd v0.14, multi workers feature had been implemented to increase thro
922
946
  </system>
923
947
  ```
924
948
 
949
+ ## Troubleshooting
950
+
951
+ ### Cannot send events to Elasticsearch
952
+
953
+ A common cause of failure is that you are trying to connect to an Elasticsearch instance with an incompatible version.
954
+
955
+ For example, td-agent currently bundles the 6.x series of the [elasticsearch-ruby](https://github.com/elastic/elasticsearch-ruby) library. This means that your Elasticsearch server also needs to be 6.x. You can check the actual version of the client library installed on your system by executing the following command.
956
+
957
+ ```
958
+ # For td-agent users
959
+ $ /usr/sbin/td-agent-gem list elasticsearch
960
+ # For standalone Fluentd users
961
+ $ fluent-gem list elasticsearch
962
+ ```
963
+ Or, fluent-plugin-elasticsearch v2.11.7 or later, users can inspect version incompatibility with the `validate_client_version` option:
964
+
965
+ ```
966
+ validate_client_version true
967
+ ```
968
+
969
+ If you get the following error message, please consider to install compatibile elasticsearch client gems:
970
+
971
+ ```
972
+ Detected ES 5 but you use ES client 6.1.0.
973
+ Please consider to use 5.x series ES client.
974
+ ```
975
+
976
+ For further details of the version compatibility issue, please read [the official manual](https://github.com/elastic/elasticsearch-ruby#compatibility).
977
+
978
+ ### Cannot see detailed failure log
979
+
980
+ A common cause of failure is that you are trying to connect to an Elasticsearch instance with an incompatible ssl protocol version.
981
+
982
+ For example, `out_elasticsearch` set up ssl_version to TLSv1 due to historical reason.
983
+ Modern Elasticsearch ecosystem requests to communicate with TLS v1.2 or later.
984
+ But, in this case, `out_elasticsearch` conceals transporter part failure log by default.
985
+ If you want to aquire transporter log, please consider to set the following configuration:
986
+
987
+ ```
988
+ with_transporter_log true
989
+ @log_level debug
990
+ ```
991
+
992
+ Then, the following log is shown in Fluentd log:
993
+
994
+ ```
995
+ 2018-10-24 10:00:00 +0900 [error]: #0 [Faraday::ConnectionFailed] SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol (OpenSSL::SSL::SSLError) {:host=>"elasticsearch-host", :port=>80, :scheme=>"https", :user=>"elastic", :password=>"changeme", :protocol=>"https"}
996
+ ```
997
+
998
+ This indicates that inappropriate TLS protocol version is used.
999
+ If you want to use TLS v1.2, please use `ssl_version` parameter like as:
1000
+
1001
+ ```
1002
+ ssl_version TLSv1_2
1003
+ ```
1004
+
1005
+ ### Cannot connect TLS enabled reverse Proxy
1006
+
1007
+ A common cause of failure is that you are trying to connect to an Elasticsearch instance behind nginx reverse proxy which uses an incompatible ssl protocol version.
1008
+
1009
+ For example, `out_elasticsearch` set up ssl_version to TLSv1 due to historical reason.
1010
+ Nowadays, nginx reverse proxy uses TLS v1.2 or later for security reason.
1011
+ But, in this case, `out_elasticsearch` conceals transporter part failure log by default.
1012
+
1013
+ If you set up nginx reverse proxy with TLS v1.2:
1014
+
1015
+ ```
1016
+ server {
1017
+ listen <your IP address>:9400;
1018
+ server_name <ES-Host>;
1019
+ ssl on;
1020
+ ssl_certificate /etc/ssl/certs/server-bundle.pem;
1021
+ ssl_certificate_key /etc/ssl/private/server-key.pem;
1022
+ ssl_client_certificate /etc/ssl/certs/ca.pem;
1023
+ ssl_verify_client on;
1024
+ ssl_verify_depth 2;
1025
+
1026
+ # Reference : https://cipherli.st/
1027
+ ssl_protocols TLSv1.2;
1028
+ ssl_prefer_server_ciphers on;
1029
+ ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
1030
+ ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
1031
+ ssl_session_cache shared:SSL:10m;
1032
+ ssl_session_tickets off; # Requires nginx >= 1.5.9
1033
+ ssl_stapling on; # Requires nginx >= 1.3.7
1034
+ ssl_stapling_verify on; # Requires nginx => 1.3.7
1035
+ resolver 127.0.0.1 valid=300s;
1036
+ resolver_timeout 5s;
1037
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
1038
+ add_header X-Frame-Options DENY;
1039
+ add_header X-Content-Type-Options nosniff;
1040
+
1041
+ client_max_body_size 64M;
1042
+ keepalive_timeout 5;
1043
+
1044
+ location / {
1045
+ proxy_set_header Host $host;
1046
+ proxy_set_header X-Real-IP $remote_addr;
1047
+ proxy_pass http://localhost:9200;
1048
+ }
1049
+ }
1050
+ ```
1051
+
1052
+ Then, nginx reverse proxy starts with TLSv1.2.
1053
+
1054
+ Fluentd suddenly dies with the following log:
1055
+ ```
1056
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: log writing failed. execution expired
1057
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/ssl_socket.rb:10:in `initialize': stack level too deep (SystemStackError)
1058
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/connection.rb:429:in `new'
1059
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/connection.rb:429:in `socket'
1060
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/connection.rb:111:in `request_call'
1061
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/mock.rb:48:in `request_call'
1062
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/instrumentor.rb:26:in `request_call'
1063
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/base.rb:16:in `request_call'
1064
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/base.rb:16:in `request_call'
1065
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/excon-0.62.0/lib/excon/middlewares/base.rb:16:in `request_call'
1066
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: ... 9266 levels...
1067
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/td-agent/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
1068
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.2.5/bin/fluentd:8:in `<top (required)>'
1069
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/bin/fluentd:22:in `load'
1070
+ Oct 31 9:44:45 <ES-Host> fluentd[6442]: from /opt/fluentd/embedded/bin/fluentd:22:in `<main>'
1071
+ Oct 31 9:44:45 <ES-Host> systemd[1]: fluentd.service: Control process exited, code=exited status=1
1072
+ ```
1073
+
1074
+ If you want to aquire transporter log, please consider to set the following configuration:
1075
+
1076
+ ```
1077
+ with_transporter_log true
1078
+ @log_level debug
1079
+ ```
1080
+
1081
+ Then, the following log is shown in Fluentd log:
1082
+
1083
+ ```
1084
+ 2018-10-31 10:00:57 +0900 [warn]: #7 [Faraday::ConnectionFailed] Attempt 2 connecting to {:host=>"<ES-Host>", :port=>9400, :scheme=>"https", :protocol=>"https"}
1085
+ 2018-10-31 10:00:57 +0900 [error]: #7 [Faraday::ConnectionFailed] Connection reset by peer - SSL_connect (Errno::ECONNRESET) {:host=>"<ES-Host>", :port=>9400, :scheme=>"https", :protocol=>"https"}
1086
+ ```
1087
+
1088
+ The above logs indicates that using incompatibile SSL/TLS version between fluent-plugin-elasticsearch and nginx, which is reverse proxy, is root cause of this issue.
1089
+
1090
+ If you want to use TLS v1.2, please use `ssl_version` parameter like as:
1091
+
1092
+ ```
1093
+ ssl_version TLSv1_2
1094
+ ```
1095
+
925
1096
  ## Contact
926
1097
 
927
1098
  If you have a question, [open an Issue](https://github.com/uken/fluent-plugin-elasticsearch/issues).
@@ -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.12.0'
6
+ s.version = '2.12.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}
@@ -16,7 +16,7 @@ class Fluent::Plugin::ElasticsearchErrorHandler
16
16
  end
17
17
 
18
18
  def unrecoverable_error_types
19
- ["out_of_memory_error", "es_rejected_execution_exception"]
19
+ @plugin.unrecoverable_error_types
20
20
  end
21
21
 
22
22
  def unrecoverable_error?(type)
@@ -123,6 +123,7 @@ EOC
123
123
  config_param :http_backend, :enum, list: [:excon, :typhoeus], :default => :excon
124
124
  config_param :validate_client_version, :bool, :default => false
125
125
  config_param :prefer_oj_serializer, :bool, :default => false
126
+ config_param :unrecoverable_error_types, :array, :default => ["out_of_memory_error", "es_rejected_execution_exception"]
126
127
 
127
128
  config_section :buffer do
128
129
  config_set_default :@type, DEFAULT_BUFFER_TYPE
@@ -8,10 +8,12 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
8
8
  class TestPlugin
9
9
  attr_reader :log
10
10
  attr_reader :write_operation, :error_events
11
+ attr_accessor :unrecoverable_error_types
11
12
  def initialize(log)
12
13
  @log = log
13
14
  @write_operation = 'index'
14
15
  @error_events = []
16
+ @unrecoverable_error_types = ["out_of_memory_error", "es_rejected_execution_exception"]
15
17
  end
16
18
 
17
19
  def router
@@ -176,6 +178,46 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
176
178
  end
177
179
  end
178
180
 
181
+ def test_es_rejected_execution_exception_responses_as_not_error
182
+ plugin = TestPlugin.new(@log)
183
+ plugin.unrecoverable_error_types = ["out_of_memory_error"]
184
+ handler = Fluent::Plugin::ElasticsearchErrorHandler.new(plugin)
185
+ records = [{time: 123, record: {"foo" => "bar", '_id' => 'abc'}}]
186
+ response = parse_response(%({
187
+ "took" : 0,
188
+ "errors" : true,
189
+ "items" : [
190
+ {
191
+ "create" : {
192
+ "_index" : "foo",
193
+ "status" : 429,
194
+ "_type" : "bar",
195
+ "error" : {
196
+ "type" : "es_rejected_execution_exception",
197
+ "reason":"rejected execution of org.elasticsearch.transport.TransportService"
198
+ }
199
+ }
200
+ }
201
+ ]
202
+ }))
203
+
204
+ begin
205
+ failed = false
206
+ chunk = MockChunk.new(records)
207
+ dummy_extracted_values = []
208
+ handler.handle_error(response, 'atag', chunk, response['items'].length, dummy_extracted_values)
209
+ rescue Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchRequestAbortError, Fluent::Plugin::ElasticsearchOutput::RetryStreamError=>e
210
+ failed = true
211
+ records = [].tap do |records|
212
+ next unless e.respond_to?(:retry_stream)
213
+ e.retry_stream.each {|time, record| records << record}
214
+ end
215
+ # should retry chunk when unrecoverable error is not thrown
216
+ assert_equal 1, records.length
217
+ end
218
+ assert_true failed
219
+ end
220
+
179
221
  def test_retry_error
180
222
  records = []
181
223
  error_records = Hash.new(false)
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.12.0
4
+ version: 2.12.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: 2018-10-17 00:00:00.000000000 Z
12
+ date: 2018-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd