fluent-plugin-elasticsearch 2.12.1 → 2.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +4 -0
- data/ISSUE_TEMPLATE.md +1 -1
- data/README.md +112 -0
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/out_elasticsearch.rb +12 -6
- data/test/plugin/test_out_elasticsearch.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d97d7d622a14ab5bf55b08dfb20792ce7893988b9f47abc013d33afbb735166
|
4
|
+
data.tar.gz: 4e585b0c87f929d083e9c20c137f22da6f5260d24032bfd9baf4c8fc8c109287
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a5c1b5b7b27575c92350f9338a39f684d5f7facfb3f4ad182642c9a210e5dea912d575e8a35b763c14f7d019ecf3cb9982bc95434436b9fe378a2fdf30704cb
|
7
|
+
data.tar.gz: 573c3b6c23ddbe42173952f914f3e702c3a8eb9ff839e78e108bb372b786351bd47383d05fa7628a065de8a10718fba1e4c5220d624ae4cdf831abd106ff4031
|
data/History.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
### [Unreleased]
|
4
4
|
|
5
|
+
### 2.12.2
|
6
|
+
- Verify connection at startup (#504)
|
7
|
+
- Add faq for glob pattern tag routing (#502)
|
8
|
+
|
5
9
|
### 2.12.1
|
6
10
|
- Make configurable unrecoverable types (#501)
|
7
11
|
- Add FAQ for TLS enabled nginx proxy TLS version incompatibility trouble (#496)
|
data/ISSUE_TEMPLATE.md
CHANGED
@@ -17,10 +17,10 @@ Provide example config and message
|
|
17
17
|
#### Using Fluentd and ES plugin versions
|
18
18
|
|
19
19
|
* OS version
|
20
|
+
* Bare Metal or within Docker or Kubernetes or others?
|
20
21
|
* Fluentd v0.12 or v0.14/v1.0
|
21
22
|
* paste result of ``fluentd --version`` or ``td-agent --version``
|
22
23
|
* ES plugin 2.x.y or 1.x.y
|
23
24
|
* paste boot log of fluentd or td-agent
|
24
25
|
* paste result of ``fluent-gem list``, ``td-agent-gem list`` or your Gemfile.lock
|
25
26
|
* ES version (optional)
|
26
|
-
* Bear Metal or Within Docker or Kubernetes or others? (optional)
|
data/README.md
CHANGED
@@ -70,6 +70,8 @@ Current maintainers: @cosmo0920
|
|
70
70
|
+ [reload_after](#reload_after)
|
71
71
|
+ [validate_client_version](#validate-client-version)
|
72
72
|
+ [unrecoverable_error_types](#unrecoverable-error-types)
|
73
|
+
+ [verify_es version at startup](#verify_es_version_at_startup)
|
74
|
+
+ [default_elasticsearch_version](#default_elasticsearch_version)
|
73
75
|
+ [Not seeing a config you need?](#not-seeing-a-config-you-need)
|
74
76
|
+ [Dynamic configuration](#dynamic-configuration)
|
75
77
|
+ [Placeholders](#placeholders)
|
@@ -78,6 +80,7 @@ Current maintainers: @cosmo0920
|
|
78
80
|
+ [Cannot send events to elasticsearch](#cannot-send-events-to-elasticsearch)
|
79
81
|
+ [Cannot see detailed failure log](#cannot-see-detailed-failure-log)
|
80
82
|
+ [Cannot connect TLS enabled reverse Proxy](#cannot-connect-tls-enabled-reverse-proxy)
|
83
|
+
+ [Declined logs are resubmitted forever, why?](#declined-logs-are-resubmitted-forever-why)
|
81
84
|
* [Contact](#contact)
|
82
85
|
* [Contributing](#contributing)
|
83
86
|
* [Running tests](#running-tests)
|
@@ -844,6 +847,27 @@ Then, remove `es_rejected_execution_exception` from `unrecoverable_error_types`
|
|
844
847
|
unrecoverable_error_types ["out_of_memory_error"]
|
845
848
|
```
|
846
849
|
|
850
|
+
### verify_es_version_at_startup
|
851
|
+
|
852
|
+
Because Elasticsearch plugin should change behavior each of Elasticsearch major versions.
|
853
|
+
|
854
|
+
For example, Elasticsearch 6 starts to prohibit multiple type_names in one index, and Elasticsearch 7 will handle only `_doc` type_name in index.
|
855
|
+
|
856
|
+
If you want to disable to verify Elasticsearch version at start up, set it as `false`.
|
857
|
+
|
858
|
+
When using the following configuration, ES plugin intends to communicate into Elasticsearch 6.
|
859
|
+
|
860
|
+
```
|
861
|
+
verify_es_version_at_startup false
|
862
|
+
default_elasticsearch_version 6
|
863
|
+
```
|
864
|
+
|
865
|
+
The default value is `true`.
|
866
|
+
|
867
|
+
### default_elasticsearch_version
|
868
|
+
|
869
|
+
This parameter changes that ES plugin assumes default Elasticsearch version. The default value is `5`.
|
870
|
+
|
847
871
|
### Not seeing a config you need?
|
848
872
|
|
849
873
|
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.
|
@@ -1093,6 +1117,94 @@ If you want to use TLS v1.2, please use `ssl_version` parameter like as:
|
|
1093
1117
|
ssl_version TLSv1_2
|
1094
1118
|
```
|
1095
1119
|
|
1120
|
+
### Declined logs are resubmitted forever, why?
|
1121
|
+
|
1122
|
+
Sometimes users write Fluentd configuration like this:
|
1123
|
+
|
1124
|
+
```aconf
|
1125
|
+
<match **>
|
1126
|
+
@type elasticsearch
|
1127
|
+
host localhost
|
1128
|
+
port 9200
|
1129
|
+
type_name fluentd
|
1130
|
+
logstash_format true
|
1131
|
+
time_key @timestamp
|
1132
|
+
include_timestamp true
|
1133
|
+
reconnect_on_error true
|
1134
|
+
reload_on_failure true
|
1135
|
+
reload_connections false
|
1136
|
+
request_timeout 120s
|
1137
|
+
</match>
|
1138
|
+
```
|
1139
|
+
|
1140
|
+
The above configuration does not use [`@label` feature](https://docs.fluentd.org/v1.0/articles/config-file#(5)-group-filter-and-output:-the-%E2%80%9Clabel%E2%80%9D-directive) and use glob(**) pattern.
|
1141
|
+
It is usually problematic configuration.
|
1142
|
+
|
1143
|
+
In error scenario, error events will be emitted with `@ERROR` label, and `fluent.*` tag.
|
1144
|
+
The black hole glob pattern resubmits a problematic event into pushing Elasticsearch pipeline.
|
1145
|
+
|
1146
|
+
This situation causes flood of declined log:
|
1147
|
+
|
1148
|
+
```log
|
1149
|
+
2018-11-13 11:16:27 +0000 [warn]: #0 dump an error event: error_class=Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError error="400 - Rejected by Elasticsearch" location=nil tag="app.fluentcat" time=2018-11-13 11:16:17.492985640 +0000 record={"message"=>"\xFF\xAD"}
|
1150
|
+
2018-11-13 11:16:38 +0000 [warn]: #0 dump an error event: error_class=Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError error="400 - Rejected by Elasticsearch" location=nil tag="fluent.warn" time=2018-11-13 11:16:27.978851140 +0000 record={"error"=>"#<Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError: 400 - Rejected by Elasticsearch>", "location"=>nil, "tag"=>"app.fluentcat", "time"=>2018-11-13 11:16:17.492985640 +0000, "record"=>{"message"=>"\xFF\xAD"}, "message"=>"dump an error event: error_class=Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError error=\"400 - Rejected by Elasticsearch\" location=nil tag=\"app.fluentcat\" time=2018-11-13 11:16:17.492985640 +0000 record={\"message\"=>\"\\xFF\\xAD\"}"}
|
1151
|
+
```
|
1152
|
+
|
1153
|
+
Then, user should use more concrete tag route or use `@label`.
|
1154
|
+
The following sections show two examples how to solve flood of declined log.
|
1155
|
+
One is using concrete tag routing, the other is using label routing.
|
1156
|
+
|
1157
|
+
#### Using concrete tag routing
|
1158
|
+
|
1159
|
+
The following configuration uses concrete tag route:
|
1160
|
+
|
1161
|
+
```aconf
|
1162
|
+
<match out.elasticsearch.**>
|
1163
|
+
@type elasticsearch
|
1164
|
+
host localhost
|
1165
|
+
port 9200
|
1166
|
+
type_name fluentd
|
1167
|
+
logstash_format true
|
1168
|
+
time_key @timestamp
|
1169
|
+
include_timestamp true
|
1170
|
+
reconnect_on_error true
|
1171
|
+
reload_on_failure true
|
1172
|
+
reload_connections false
|
1173
|
+
request_timeout 120s
|
1174
|
+
</match>
|
1175
|
+
```
|
1176
|
+
|
1177
|
+
#### Using label feature
|
1178
|
+
|
1179
|
+
The following configuration uses label:
|
1180
|
+
|
1181
|
+
```aconf
|
1182
|
+
<source>
|
1183
|
+
@type forward
|
1184
|
+
@label @ES
|
1185
|
+
</source>
|
1186
|
+
<label @ES>
|
1187
|
+
<match out.elasticsearch.**>
|
1188
|
+
@type elasticsearch
|
1189
|
+
host localhost
|
1190
|
+
port 9200
|
1191
|
+
type_name fluentd
|
1192
|
+
logstash_format true
|
1193
|
+
time_key @timestamp
|
1194
|
+
include_timestamp true
|
1195
|
+
reconnect_on_error true
|
1196
|
+
reload_on_failure true
|
1197
|
+
reload_connections false
|
1198
|
+
request_timeout 120s
|
1199
|
+
</match>
|
1200
|
+
</label>
|
1201
|
+
<label @ERROR>
|
1202
|
+
<match **>
|
1203
|
+
@type stdout
|
1204
|
+
</match>
|
1205
|
+
</label>
|
1206
|
+
```
|
1207
|
+
|
1096
1208
|
## Contact
|
1097
1209
|
|
1098
1210
|
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.
|
6
|
+
s.version = '2.12.2'
|
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}
|
@@ -124,6 +124,8 @@ EOC
|
|
124
124
|
config_param :validate_client_version, :bool, :default => false
|
125
125
|
config_param :prefer_oj_serializer, :bool, :default => false
|
126
126
|
config_param :unrecoverable_error_types, :array, :default => ["out_of_memory_error", "es_rejected_execution_exception"]
|
127
|
+
config_param :verify_es_version_at_startup, :bool, :default => true
|
128
|
+
config_param :default_elasticsearch_version, :integer, :default => DEFAULT_ELASTICSEARCH_VERSION
|
127
129
|
|
128
130
|
config_section :buffer do
|
129
131
|
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
@@ -216,11 +218,15 @@ EOC
|
|
216
218
|
end
|
217
219
|
|
218
220
|
@last_seen_major_version =
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
221
|
+
if @verify_es_version_at_startup
|
222
|
+
begin
|
223
|
+
detect_es_major_version
|
224
|
+
rescue
|
225
|
+
log.warn "Could not connect Elasticsearch or obtain version. Assuming Elasticsearch #{@default_elasticsearch_version}."
|
226
|
+
@default_elasticsearch_version
|
227
|
+
end
|
228
|
+
else
|
229
|
+
@default_elasticsearch_version
|
224
230
|
end
|
225
231
|
if @last_seen_major_version == 6 && @type_name != DEFAULT_TYPE_NAME_ES_7x
|
226
232
|
log.info "Detected ES 6.x: ES 7.x will only accept `_doc` in type_name."
|
@@ -500,7 +506,7 @@ EOC
|
|
500
506
|
|
501
507
|
tag = chunk.metadata.tag
|
502
508
|
extracted_values = expand_placeholders(chunk.metadata)
|
503
|
-
@last_seen_major_version = detect_es_major_version rescue
|
509
|
+
@last_seen_major_version = detect_es_major_version rescue @default_elasticsearch_version
|
504
510
|
|
505
511
|
chunk.msgpack_each do |time, record|
|
506
512
|
next unless record.is_a? Hash
|
@@ -217,6 +217,9 @@ class ElasticsearchOutput < Test::Unit::TestCase
|
|
217
217
|
assert_equal "fluentd", default_type_name
|
218
218
|
assert_equal :excon, instance.http_backend
|
219
219
|
assert_false instance.prefer_oj_serializer
|
220
|
+
assert_equal ["out_of_memory_error", "es_rejected_execution_exception"], instance.unrecoverable_error_types
|
221
|
+
assert_true instance.verify_es_version_at_startup
|
222
|
+
assert_equal Fluent::Plugin::ElasticsearchOutput::DEFAULT_ELASTICSEARCH_VERSION, instance.default_elasticsearch_version
|
220
223
|
end
|
221
224
|
|
222
225
|
test 'configure Content-Type' do
|
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.
|
4
|
+
version: 2.12.2
|
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-11-
|
12
|
+
date: 2018-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|